Separate config for development/production #6

Closed
kbjr opened this Issue Apr 9, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@kbjr
Owner

kbjr commented Apr 9, 2012

Some method of determining environments is needed in config files. This will likely be controlled by a cli arg given to crux start / core/init.js, eg.

$ crux start --env=development

The default should be "production" so that no extra config is needed to deploy.

kbjr added a commit that referenced this issue Apr 21, 2012

@kbjr

This comment has been minimized.

Show comment
Hide comment
@kbjr

kbjr Apr 21, 2012

Owner

The current changes for environment support allow for the environment to be defined two different ways. First, the environment can be set as a cli arg, eg.

$ crux start --environment development

Second, it can also be provided as an environment variable, eg.

$ CRUX_ENVIRONMENT=development node ./core/init.js

If an environment arg is given, it will always have precedence over a cli arg. If no environment is given either way, it will default to "production".

In the ./config directory, there is now a directory global where the config files (which are now .js files, not .json) have been moved. To make use of the environment value, a new directory can be created in ./config where override config values can be defined (eg. a file ./config/development/http.js could be created to change the hostname and port when in development).

Also, the current environment can be determined using $.environment();.

Owner

kbjr commented Apr 21, 2012

The current changes for environment support allow for the environment to be defined two different ways. First, the environment can be set as a cli arg, eg.

$ crux start --environment development

Second, it can also be provided as an environment variable, eg.

$ CRUX_ENVIRONMENT=development node ./core/init.js

If an environment arg is given, it will always have precedence over a cli arg. If no environment is given either way, it will default to "production".

In the ./config directory, there is now a directory global where the config files (which are now .js files, not .json) have been moved. To make use of the environment value, a new directory can be created in ./config where override config values can be defined (eg. a file ./config/development/http.js could be created to change the hostname and port when in development).

Also, the current environment can be determined using $.environment();.

kbjr added a commit that referenced this issue Apr 21, 2012

@kbjr kbjr closed this in ef8c9ee Apr 21, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment