Skip to content

Commit

Permalink
add environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
poupotte committed Apr 23, 2013
1 parent 71a78c8 commit c82d2c2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/paas.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
haibu = require('haibu-api')
fs = require 'fs'
compound = require 'compound'
HttpClient = require("request-json").JsonClient
MemoryManager = require("./memory").MemoryManager
haibuUrl = "http://localhost:9002/"
Expand All @@ -21,13 +22,16 @@ class exports.AppManager
).drone

getAuthController = (callback) ->
fs.readFile '/etc/cozy/controller.token', 'utf8', (err, data) =>
if err isnt null
console.log "Cannot read token"
callback err
else
token = data.split('\n')[0]
callback null, token
if process.env.ENV_VARIABLE == 'production'
fs.readFile '/etc/cozy/controller.token', 'utf8', (err, data) =>
if err isnt null
console.log "Cannot read token"
callback err
else
token = data.split('\n')[0]
callback null, token
else
callback null, ""

@client.brunch = (manifest, callback) =>
data = brunch: manifest
Expand Down
1 change: 1 addition & 0 deletions server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if not module.parent
server = app()

server.listen port, host, ->
process.env.ENV_VARIABLE = server.set 'env'
console.log(
"Railway server listening on %s:%d within %s environment",
host, port,
Expand Down

0 comments on commit c82d2c2

Please sign in to comment.