Skip to content

Loading…

Separate config for development/production #6

Closed
kbjr opened this Issue · 1 comment

1 participant

@kbjr
Owner

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 kbjr added a commit that referenced this issue
@kbjr #6 working on environment support 3147238
@kbjr
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();.

@kbjr kbjr added a commit that referenced this issue
@kbjr #6 working on environment support 1a77a2b
@kbjr kbjr added a commit that closed this issue
@kbjr fixed #6; environments supported ef8c9ee
@kbjr kbjr closed this in ef8c9ee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.