Files
docker-inventaire/inventaire/docker-entrypoint.sh

69 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eu
cd /opt/inventaire
# Overwrites the local config with environment variables every time the container is restarted
# This file can be itself overwritten either by ./config/local-production.cjs (assuming NODE_ENV=production) or by NODE_CONFIG
# See https://github.com/node-config/node-config/wiki/Configuration-Files#file-load-order
# and https://github.com/node-config/node-config/wiki/Environment-Variables#node_config
cat > "./config/local.cjs" << EOF
module.exports = {
hostname: 'inventaire',
port: '${INVENTAIRE_PORT}',
publicHostname: '${PUBLIC_HOSTNAME}',
instanceName: '${INSTANCE_NAME}',
orgName: '${ORG_NAME}',
orgUrl: '${ORG_URL}',
contactAddress: '${CONTACT_ADDRESS}',
db: {
username: '${COUCHDB_USER}',
password: '${COUCHDB_PASSWORD}',
hostname: 'couchdb',
backupDirectory: '/opt/inventaire_backups',
},
leveldb: {
directory: '/opt/inventaire_leveldb'
},
elasticsearch: {
origin: 'http://elasticsearch:9200',
},
mailer: {
disabled: false,
nodemailer: {
host: '${MAILER_SMTP_HOST}',
port: ${MAILER_SMTP_PORT},
auth: {
user: '${MAILER_SMTP_USERNAME}',
pass: '${MAILER_SMTP_PASSWORD}'
},
},
},
mapTilesAccessToken: '${MAP_TILES_ACCESS_TOKEN}',
matomo: {
enabled: ${MOTOMO_ENABLED},
endpoint: '${MOTOMO_ENDPOINT}',
idsite: ${MOTOMO_IDSITE},
rec: ${MOTOMO_REC},
},
mediaStorage: {
mode: '${MEDIA_STORAGE_MODE}',
swift: {
username: '${SWIFT_USERNAME}',
password: '${SWIFT_PASSWORD}',
authUrl: '${SWIFT_AUTH_URL}',
publicURL: '${SWIFT_PUBLIC_URL}',
tenantName: '${SWIFT_TENANT_NAME}',
region: '${SWIFT_REGION}',
},
local: {
directory: '/opt/inventaire_local_media_storage'
},
},
}
EOF
./scripts/typescript/start_built_server.sh