Skip to content

Commit

Permalink
Extract Configuration#initialize and save the environment as @env
Browse files Browse the repository at this point in the history
  • Loading branch information
sstephenson committed Nov 14, 2011
1 parent e93d5d7 commit 1b1cd5b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
15 changes: 10 additions & 5 deletions lib/configuration.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions src/configuration.coffee
Expand Up @@ -52,13 +52,17 @@ module.exports = class Configuration
# A list of option names accessible on `Configuration` instances.
@optionNames: [
"bin", "dstPort", "httpPort", "dnsPort", "timeout", "workers",
"domains", "extDomains", "hostRoot", "logRoot", "rvmPath"
"domains", "extDomains", "hostRoot", "logRoot", "rvmPath", "env"
]

# Pass in any environment variables you'd like to override when
# creating a `Configuration` instance. Valid variables and their
# defaults:
# creating a `Configuration` instance.
constructor: (env = process.env) ->
@loggers = {}
@initialize env

# Valid environment variables and their defaults:
initialize: (@env) ->
# `POW_BIN`: the path to the `pow` binary. (This should be
# correctly configured for you.)
@bin = env.POW_BIN ? path.join __dirname, "../bin/pow"
Expand Down Expand Up @@ -115,8 +119,6 @@ module.exports = class Configuration
@rvmPath = env.POW_RVM_PATH ? path.join process.env.HOME, ".rvm/scripts/rvm"

# ---
@loggers = {}

# Precompile regular expressions for matching domain names to be
# served by the DNS server and hosts to be served by the HTTP
# server.
Expand Down

0 comments on commit 1b1cd5b

Please sign in to comment.