Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Config files in addition to env variables #289

Open
akre54 opened this issue Sep 9, 2018 · 2 comments
Open

Config files in addition to env variables #289

akre54 opened this issue Sep 9, 2018 · 2 comments

Comments

@akre54
Copy link

akre54 commented Sep 9, 2018

I'd like to propose the ability to load Fusion config variables from a file instead of requiring that they live in an env variable, similar to dotenv.

Certain properties like ROUTE_PREFIX and ROOT_DIR are really app-specific and app-wide globals, and the current method of passing them as env variables before calling the fusion-cli (or even worse, setting them in your local dev environment) seem to be at odds with their intended usage.

Ideally, the resolving order would go, in order of precedence:

  1. Environment variables from process.env
  2. A file loaded from config/development.js / config.production.js (i.e. use NODE_ENV / FUSION_ENV)
  3. A file loaded from config/common.js

I like that Fusion puts most other local config in src/config, but it would be great to have a place for app-wide fusion variables to live that doesn't require hacking a package.json.

@KevinGrandon
Copy link
Contributor

Related: fusionjs/fusion-cli#523

@alexindigo
Copy link

I created config library with the "12 factors" in mind and it has support for environment variables override, with specific order of precedence (e.g. config/default, config/development / config/production, config/custom-environment-variables, etc). And allows great deal of customizations.
Maybe it could be useful for your project: https://www.npmjs.com/package/configly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants