// Generated by CoffeeScript 1.12.7
(function() {
  var JL, JS, cfenv, generateDump, http;

  http = require("http");

  cfenv = require("..");

  exports.main = function() {
    var appEnv, dump, server;
    appEnv = cfenv.getAppEnv();
    dump = generateDump(appEnv);
    server = http.createServer();
    server.on("request", function(request, response) {
      response.writeHead(200, {
        "Content-Type": "text/plain"
      });
      return response.end(dump);
    });
    return server.listen(appEnv.port, appEnv.bind, function() {
      return console.log("server starting on " + appEnv.url);
    });
  };

  generateDump = function(appEnv) {
    var result, serviceURL, services;
    result = [];
    result.push("cfenv.getAppEnv(): " + (JL(appEnv)));
    services = appEnv.getServices();
    result.push("appEnv.getServices(): " + (JL(services)));
    serviceURL = appEnv.getServiceURL("cf-env-test", {
      pathname: "database",
      auth: ["username", "password"]
    });
    result.push("appEnv.getServiceURL(): " + serviceURL);
    return result.join("\n\n");
  };

  JS = function(object) {
    return JSON.stringify(object);
  };

  JL = function(object) {
    return JSON.stringify(object, null, 4);
  };

  if (require.main === module) {
    exports.main();
  }

}).call(this);
