This commit is contained in:
cupcakearmy 2022-05-29 11:31:18 +02:00
parent 9500bcf68c
commit a47d5974e4
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F
4 changed files with 27 additions and 6 deletions

View File

@ -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

View File

@ -0,0 +1,4 @@
logLevel: warn
allowedDomains:
- example.org

View File

@ -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)

View File

@ -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',