From 421980c5b2c21ac7d7616d3f312a50f40964b83d Mon Sep 17 00:00:00 2001 From: rainu Date: Mon, 25 Feb 2019 19:47:36 +0100 Subject: [PATCH] use the feature of yaml-env instead of reading ENV in entrypoint.sh --- Dockerfile | 2 +- config/config.yaml.docker | 50 ++++++++++++++++++++++ entrypoint.sh | 89 +-------------------------------------- 3 files changed, 52 insertions(+), 89 deletions(-) create mode 100644 config/config.yaml.docker diff --git a/Dockerfile b/Dockerfile index 20fd471..64cbdc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ARG TURTL_SERVER_PLUGIN_LOCATION EXPOSE 8181 WORKDIR /app COPY . . -COPY config/config.yaml.default config/config.yaml +COPY config/config.yaml.docker config/config.yaml RUN apk add -U bash git &&\ npm install --production &&\ diff --git a/config/config.yaml.docker b/config/config.yaml.docker new file mode 100644 index 0000000..6044313 --- /dev/null +++ b/config/config.yaml.docker @@ -0,0 +1,50 @@ +--- +server: + port: 8181 + +db: + host: 'db' + port: 5432 + database: 'turtl' + user: 'turtl' + password: '' + pool: 24 + +loglevel: 'info' + +app: + enable_bookmarker_proxy: false + # no trailing slash + api_url: 'http://127.0.0.1:8181' + www_url: 'https://yourdomain.com' + emails: + admin: 'admin@turtlapp.com' + info: 'Turtl ' + invites: 'invites@turtlapp.com' + secure_hash_salt: "Plaque is a figment of the liberal media and the dental industry to scare you into buying useless appliances and pastes. Now, I've read the arguments on both sides and I haven't found any evidence yet to support the need to brush your teeth. Ever." + allow_unconfirmed_invites: true + +sync: + # how many sync records can a client send at a time? it's a good idea to have + # a limit here, lest a rogue client flood the server with sync items + max_bulk_sync_records: 32 + +plugins: + plugin_location: '/plugins' + analytics: + enabled: false + email: + enabled: false + premium: + enabled: false + +uploads: + local: '/uploads' + local_proxy: true + url: 'http://127.0.0.1:8181/uploads' + +s3: + token: 'IHADAPETSNAKEBUTHEDIEDNOOOOO' + secret: '' + bucket: '' + endpoint: 'https://s3.amazonaws.com' diff --git a/entrypoint.sh b/entrypoint.sh index 72e9487..27c5af7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,96 +1,9 @@ #!/bin/bash -if [ -z "${TURTL_SERVER_PORT}" ]; then TURTL_SERVER_PORT=8181; fi - -if [ -z "${TURTL_DB_HOST}" ]; then TURTL_DB_HOST="db"; fi -if [ -z "${TURTL_DB_PORT}" ]; then TURTL_DB_PORT=5432; fi -if [ -z "${TURTL_DB_DATABASE}" ]; then TURTL_DB_DATABASE="turtl"; fi -if [ -z "${TURTL_DB_USER}" ]; then TURTL_DB_USER="turtl"; fi -if [ -z "${TURTL_DB_PASSWORD}" ]; then TURTL_DB_PASSWORD=""; fi -if [ -z "${TURTL_DB_POOL}" ]; then TURTL_DB_POOL=24; fi - -if [ -z "${TURTL_LOGLEVEL}" ]; then TURTL_LOGLEVEL="info"; fi - -if [ -z "${TURTL_APP_ENABLE_BOOKMARKER_PROXY}" ]; then TURTL_APP_ENABLE_BOOKMARKER_PROXY="false"; fi -if [ -z "${TURTL_APP_API_URL}" ]; then TURTL_APP_API_URL="http://127.0.0.1:8181"; fi -if [ -z "${TURTL_APP_WWW_URL}" ]; then TURTL_APP_WWW_URL="https://yourdomain.com"; fi -if [ -z "${TURTL_APP_EMAILS_ADMIN}" ]; then TURTL_APP_EMAILS_ADMIN="admin@turtlapp.com"; fi -if [ -z "${TURTL_APP_EMAILS_INFO}" ]; then TURTL_APP_EMAILS_INFO="Turtl "; fi -if [ -z "${TURTL_APP_EMAILS_INVITES}" ]; then TURTL_APP_EMAILS_INVITES="invites@turtlapp.com"; fi -if [ -z "${TURTL_APP_SECURE_HASH_SALT}" ]; then +if [[ -z "${TURTL_APP_SECURE_HASH_SALT}" ]]; then echo "TURTL_APP_SECURE_HASH_SALT is unset." exit 1 fi -if [ -z "${TURTL_APP_ALLOW_UNCONFIRMED_INVITES}" ]; then TURTL_APP_ALLOW_UNCONFIRMED_INVITES="true"; fi - -if [ -z "${TURTL_SYNC_MAX_BULK_SYNC_RECORDS}" ]; then TURTL_SYNC_MAX_BULK_SYNC_RECORDS=32; fi - -if [ -z "${TURTL_PLUGINS_PLUGIN_LOCATION}" ]; then TURTL_PLUGINS_PLUGIN_LOCATION="/plugins"; fi -if [ -z "${TURTL_PLUGINS_ANALYTICS}" ]; then TURTL_PLUGINS_ANALYTICS="false"; fi -if [ -z "${TURTL_PLUGINS_EMAIL}" ]; then TURTL_PLUGINS_EMAIL="false"; fi -if [ -z "${TURTL_PLUGINS_PREMIUM}" ]; then TURTL_PLUGINS_PREMIUM="false"; fi - -if [ -z "${TURTL_UPLOADS_LOCAL}" ]; then TURTL_UPLOADS_LOCAL="/uploads"; fi -if [ -z "${TURTL_UPLOADS_LOCAL_PROXY}" ]; then TURTL_UPLOADS_LOCAL_PROXY="true"; fi -if [ -z "${TURTL_UPLOADS_URL}" ]; then TURTL_UPLOADS_URL="http://127.0.0.1:8181/uploads"; fi - -if [ -z "${TURTL_S3_TOKEN}" ]; then TURTL_S3_TOKEN="IHADAPETSNAKEBUTHEDIEDNOOOOO"; fi -if [ -z "${TURTL_S3_SECRET}" ]; then TURTL_S3_SECRET=""; fi -if [ -z "${TURTL_S3_BUCKET}" ]; then TURTL_S3_BUCKET=""; fi -if [ -z "${TURTL_S3_ENDPOINT}" ]; then TURTL_S3_ENDPOINT="https://s3.amazonaws.com"; fi - - -cat >/app/config/config.yaml <