Skip to content

Commit

Permalink
fix(server): better align server config options
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyslbw committed Aug 3, 2020
1 parent f0cd5f9 commit 30a7534
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export async function getConfig (): Promise<Config> {
} = filterAndTypecastEnvs(process.env)

if (!hasuraUri && !genesisFileShelley) {
throw new MissingConfig('You have not provided configuration to load an API segment. Either set HASURA_URI or GENESIS_FILE_SHELLEY')
throw new MissingConfig(
`You have not provided configuration to load an API segment. Either set HASURA_URI or
GENESIS_FILE_SHELLEY`
)
}
if (prometheusMetrics && process.env.TRACING === 'false') {
throw new TracingRequired('Prometheus')
Expand Down Expand Up @@ -56,6 +59,7 @@ function filterAndTypecastEnvs (env: any) {
GENESIS_FILE_BYRON,
GENESIS_FILE_SHELLEY,
HASURA_URI,
NODE_ENV,
PROMETHEUS_METRICS,
QUERY_DEPTH_LIMIT,
TRACING,
Expand All @@ -66,16 +70,16 @@ function filterAndTypecastEnvs (env: any) {
Please update your configuration to use ALLOW_LIST_PATH instead.`)
}
return {
allowIntrospection: ALLOW_INTROSPECTION === 'true' ? true : undefined,
allowIntrospection: ALLOW_INTROSPECTION === 'true' || NODE_ENV !== 'production',
allowedOrigins: ALLOWED_ORIGINS,
allowListPath: ALLOW_LIST_PATH || WHITELIST_PATH,
apiPort: Number(API_PORT),
cacheEnabled: CACHE_ENABLED === 'true' ? true : undefined,
cacheEnabled: CACHE_ENABLED === 'true',
genesisFileByron: GENESIS_FILE_BYRON,
genesisFileShelley: GENESIS_FILE_SHELLEY,
hasuraUri: HASURA_URI,
prometheusMetrics: PROMETHEUS_METRICS === 'true' ? true : undefined,
prometheusMetrics: PROMETHEUS_METRICS === 'true',
queryDepthLimit: Number(QUERY_DEPTH_LIMIT),
tracing: TRACING === 'true' ? true : undefined
tracing: TRACING === 'true'
}
}

0 comments on commit 30a7534

Please sign in to comment.