Merge pull request #2845 from spotify/rugvip/appenv

Use APP_ENV to determine what config to load, falling back to NODE_ENV
This commit is contained in:
Patrik Oldsberg
2020-10-12 15:20:45 +02:00
committed by GitHub
13 changed files with 25 additions and 13 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ export async function loadBackendConfig() {
/* eslint-disable-next-line no-restricted-syntax */
const paths = findPaths(__dirname);
const configs = await loadConfig({
env: process.env.NODE_ENV ?? 'development',
env: process.env.APP_ENV ?? process.env.NODE_ENV ?? 'development',
rootPaths: [paths.targetRoot, paths.targetDir],
shouldReadSecrets: true,
});
+1 -1
View File
@@ -22,7 +22,7 @@ import { buildBundle } from '../../lib/bundler';
export default async (cmd: Command) => {
const appConfigs = await loadConfig({
env: process.env.NODE_ENV ?? 'production',
env: process.env.APP_ENV ?? process.env.NODE_ENV ?? 'production',
rootPaths: [paths.targetRoot, paths.targetDir],
});
await buildBundle({
+1 -1
View File
@@ -22,7 +22,7 @@ import { serveBundle } from '../../lib/bundler';
export default async (cmd: Command) => {
const appConfigs = await loadConfig({
env: process.env.NODE_ENV ?? 'development',
env: process.env.APP_ENV ?? process.env.NODE_ENV ?? 'development',
rootPaths: [paths.targetRoot, paths.targetDir],
});
const waitForExit = await serveBundle({
+1 -1
View File
@@ -22,7 +22,7 @@ import { serveBackend } from '../../lib/bundler/backend';
export default async (cmd: Command) => {
const appConfigs = await loadConfig({
env: process.env.NODE_ENV ?? 'development',
env: process.env.APP_ENV ?? process.env.NODE_ENV ?? 'development',
rootPaths: [paths.targetRoot, paths.targetDir],
});
+2 -1
View File
@@ -22,7 +22,8 @@ import { stringify as stringifyYaml } from 'yaml';
export default async (cmd: Command) => {
const appConfigs = await loadConfig({
env: cmd.env ?? process.env.NODE_ENV ?? 'development',
env:
cmd.env ?? process.env.APP_ENV ?? process.env.NODE_ENV ?? 'development',
shouldReadSecrets: cmd.withSecrets ?? false,
rootPaths: [paths.targetRoot, paths.targetDir],
});
+1 -1
View File
@@ -133,7 +133,7 @@ export function registerCommands(program: CommanderStatic) {
.option('--with-secrets', 'Include secrets in the printed configuration')
.option(
'--env <env>',
'The environment to print configuration for [NODE_ENV or development]',
'The environment to print configuration for [APP_ENV or NODE_ENV or development]',
)
.option(
'--format <format>',
+1 -1
View File
@@ -22,7 +22,7 @@ import { buildBundle } from '../../lib/bundler';
export default async (cmd: Command) => {
const appConfigs = await loadConfig({
env: process.env.NODE_ENV ?? 'production',
env: process.env.APP_ENV ?? process.env.NODE_ENV ?? 'production',
rootPaths: [paths.targetRoot, paths.targetDir],
});
await buildBundle({
+1 -1
View File
@@ -22,7 +22,7 @@ import { serveBundle } from '../../lib/bundler';
export default async (cmd: Command) => {
const appConfigs = await loadConfig({
env: process.env.NODE_ENV ?? 'development',
env: process.env.APP_ENV ?? process.env.NODE_ENV ?? 'development',
rootPaths: [paths.targetRoot, paths.targetDir],
});
const waitForExit = await serveBundle({
+1 -1
View File
@@ -28,7 +28,7 @@ type ResolveOptions = {
* Resolves all configuration files that should be loaded in the given environment.
*
* For each root directory, search for the default app-config.yaml, along with suffixed
* NODE_ENV and local variants, e.g. app-config.production.yaml or app-config.development.local.yaml
* APP_ENV and local variants, e.g. app-config.production.yaml or app-config.development.local.yaml
*
* The priority order of config loaded through suffixes is `env > local > none`, meaning that
* for example app-config.development.yaml has higher priority than `app-config.local.yaml`.