const yamlConfig = require("node-yaml-config"); const baseConfig = yamlConfig.load("./config/config.yml", process.env.OGURY_ENV); export const config = Object.keys(baseConfig).reduce((acc, current) => { acc[current] = getEnvVar(current) || baseConfig[current]; return acc; }, {} as Record); export function isUnitTest(): boolean { return config.OGURY_ENV === "test"; } export function isIntegrationTest(): boolean { return config.OGURY_ENV === "integration_test"; } export function isTest(): boolean { return isUnitTest() || isIntegrationTest(); } function getEnvVar(key: string): any { if ( typeof process.env[key] !== "undefined" && process.env[key] !== null && process.env[key] !== "" ) { return process.env[key]; } }