Commit d393015f835e882e9ded1efb5f5b459f624ee943
extract into `simple-rc` module
Michael Williams committed on 1/2/2016, 1:22:09 PMParent: 2701b2aa389b3a8acde4ec8c6b2ffe3b13cc49a4
Files changed
app/config.js | changed |
app/package.json | changed |
app/config-browser.js | deleted |
config/defaults.js | deleted |
config/index.js | added |
package.json | changed |
app/config.js | ||
---|---|---|
@@ -1,14 +1,1 @@ | ||
1 | -const { join } = require('path') | |
2 | - | |
3 | -const configDir = join(__dirname, '..', 'config') | |
4 | -const nodeEnv = process.env.NODE_ENV || 'development' | |
5 | - | |
6 | -const defaults = require(join(configDir, 'defaults')) | |
7 | -const envConfig = require(join(configDir, nodeEnv)) | |
8 | - | |
9 | -const config = { | |
10 | - ...defaults, | |
11 | - ...envConfig | |
12 | -} | |
13 | - | |
14 | -module.exports = config | |
1 | +module.exports = require('simple-rc')() |
app/package.json | ||
---|---|---|
@@ -1,15 +1,19 @@ | ||
1 | 1 | { |
2 | 2 | "browser": { |
3 | - "./api.js": "./clients/index.js", | |
4 | - "./config.js": "./config-browser.js" | |
3 | + "./api.js": "./clients/index.js" | |
5 | 4 | }, |
6 | 5 | "browserify": { |
7 | 6 | "transform": [ |
8 | 7 | ["cssify", { "modules": true } ], |
9 | 8 | "babelify", |
10 | 9 | "envify", |
11 | - ["evalify", { "files": [ "config-browser.js" ] } ], | |
12 | 10 | "bulkify" |
13 | 11 | ] |
12 | + }, | |
13 | + "rc": { | |
14 | + "files": [ | |
15 | + "../config/${NODE_ENV}", | |
16 | + "../config" | |
17 | + ] | |
14 | 18 | } |
15 | 19 | } |
app/config-browser.js | ||
---|---|---|
@@ -1,3 +1,0 @@ | ||
1 | -const config = require('./config') | |
2 | - | |
3 | -module.exports = config.browser |
config/defaults.js | ||
---|---|---|
@@ -1,10 +1,0 @@ | ||
1 | -const { join } = require('path') | |
2 | -const env = process.env | |
3 | -const nodeEnv = env.NODE_ENV | |
4 | - | |
5 | -module.exports = { | |
6 | - static: { | |
7 | - root: join(__dirname, '..', 'build') | |
8 | - }, | |
9 | - port: env.PORT || 5000 | |
10 | -} |
Built with git-ssb-web