diff --git a/Dockerfile b/Dockerfile index c86e45b..9e56347 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,8 @@ FROM node:16-alpine as base WORKDIR /app RUN npm -g i pnpm@7 +# Needed for node-gyp +RUN apk add --no-cache python3 # BUILDER FROM base as builder diff --git a/docker/local/morphus.yaml b/docker/local/morphus.yaml new file mode 100644 index 0000000..5abff5e --- /dev/null +++ b/docker/local/morphus.yaml @@ -0,0 +1,4 @@ +logLevel: warn + +allowedDomains: + - example.org diff --git a/scripts/generate_markdown_tables.mjs b/scripts/generate_markdown_tables.mjs index 78addd9..d133109 100644 --- a/scripts/generate_markdown_tables.mjs +++ b/scripts/generate_markdown_tables.mjs @@ -2,9 +2,10 @@ import { config, StorageType } from '../dist/src/config.js' const schema = config._def -function stringAsMarkdownCode(string) { - return '`' + string + '`' -} +const asInlineCode = (s) => '`' + s + '`' +const formatInline = (s, empty = '') => (s === undefined ? empty : asInlineCode(s)) +const formatEnv = (s) => formatInline(s, 'not supported') +const formatDefault = (s) => formatInline(s, '') for (const storage of Object.values(StorageType)) { const storageType = schema[storage] @@ -13,7 +14,21 @@ for (const storage of Object.values(StorageType)) { | ---------------- | ------------------ | ------- | ------------------------ | ` for (const [key, value] of Object.entries(storageType)) { - table += `| \`${storage}.${key}\` | \`${value.env}\` | ${value.default} | ${value.doc} |\n` + table += `| \`${storage}.${key}\` | ${formatEnv(value.env)} | ${formatDefault(value.default)} | ${value.doc} |\n` + } + + console.log(table) +} + +{ + let table = ` + | Config | Environment | Default | Description | + | ------- | ----------- | ------- | ------------ | +` + + for (const [key, value] of Object.entries(schema)) { + if (Object.values(StorageType).includes(key)) continue + table += `| ${asInlineCode(key)} | ${formatEnv(value.env)} | ${formatDefault(value.default)} | ${value.doc} |\n` } console.log(table) diff --git a/src/config.ts b/src/config.ts index 2777fbc..a4ebccc 100644 --- a/src/config.ts +++ b/src/config.ts @@ -83,14 +83,14 @@ export const config = convict({ format: formatNullableStringOrRegexpArray, default: null as NullableStringOrRegexpArray, nullable: true, - env: 'ALLOWED_DOMAINS', + // env: 'ALLOWED_DOMAINS', // See: https://github.com/mozilla/node-convict/issues/399 }, allowedHosts: { doc: 'The hosts that are allowed to access the images', format: formatNullableStringOrRegexpArray, default: null as NullableStringOrRegexpArray, nullable: true, - env: 'ALLOWED_HOSTS', + // env: 'ALLOWED_HOSTS', // See: https://github.com/mozilla/node-convict/issues/399 }, cleanUrls: { doc: 'Whether to clean URLs',