|
|
@ -20,14 +20,20 @@ const { getPathMap } = require("./scripts/path-map"); |
|
|
|
const loadConfig = (env = 'dev') => { |
|
|
|
const loadConfig = (env = 'dev') => { |
|
|
|
const configPath = `./config/${env}.json`; |
|
|
|
const configPath = `./config/${env}.json`; |
|
|
|
if (!fs.existsSync(configPath)) { |
|
|
|
if (!fs.existsSync(configPath)) { |
|
|
|
console.log(`Config file not found: ${configPath}`); |
|
|
|
console.warn(`Config file not found: ${configPath}. Using environment variables only.`); |
|
|
|
process.exit(1); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log(`Config file found: ${configPath}`); |
|
|
|
const appConfig = {}; |
|
|
|
|
|
|
|
|
|
|
|
// @todo stringify the values for webpack - it doesn't understand objects
|
|
|
|
for (let key in process.env) { |
|
|
|
return require(configPath); |
|
|
|
if (!key.startsWith('ROADMAP_')) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appConfig[key.replace('ROADMAP_', '')] = process.env[key]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return appConfig; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const options = { |
|
|
|
const options = { |
|
|
|