diff --git a/.env.sample b/.env.sample index 675461d..b4074c6 100644 --- a/.env.sample +++ b/.env.sample @@ -5,6 +5,9 @@ DOMAIN=federatedwiki.example.com #EXTRA_DOMAINS=', `www.federatedwiki.example.com`' LETS_ENCRYPT_ENV=production +# Predefined "owner" security +#COMPOSE_FILE="compose.yml:compose.owner.yml" + COOKIE_SECRET="asflkjqpweoriuwpeogdjgbpdofigh" AUTHOR="Baja Colorado" PASSWORD="Please Choose a Better Password" diff --git a/abra.sh b/abra.sh index 1f21482..3564c8e 100644 --- a/abra.sh +++ b/abra.sh @@ -1,3 +1,3 @@ -export INSTALL_SH_VERSION=v5 -export CONFIG_JSON_VERSION=v3 +export INSTALL_SH_VERSION=v7 +export CONFIG_JSON_VERSION=v6 export CONFIG_OWNER_JSON_VERSION=v3 diff --git a/compose.owner.yml b/compose.owner.yml new file mode 100644 index 0000000..678205a --- /dev/null +++ b/compose.owner.yml @@ -0,0 +1,15 @@ + +--- +version: "3.8" + +services: + app: + configs: + - source: config_owner_json_conf + target: /home/node/config/config.owner.json + +configs: + config_owner_json_conf: + name: ${STACK_NAME}_config_owner_json_${CONFIG_OWNER_JSON_VERSION} + file: config.owner.json.tmpl + template_driver: golang diff --git a/compose.yml b/compose.yml index 1700abb..9e45371 100644 --- a/compose.yml +++ b/compose.yml @@ -15,8 +15,6 @@ services: target: /home/node/config/install.sh - source: config_json_conf target: /home/node/config/config.json - - source: config_owner_json_conf - target: /home/node/config/config.owner.json environment: - DOMAIN - COOKIE_SECRET @@ -56,7 +54,3 @@ configs: name: ${STACK_NAME}_config_json_${CONFIG_JSON_VERSION} file: config.json.tmpl template_driver: golang - config_owner_json_conf: - name: ${STACK_NAME}_config_owner_json_${CONFIG_OWNER_JSON_VERSION} - file: config.owner.json.tmpl - template_driver: golang diff --git a/config.json.tmpl b/config.json.tmpl index 1ed160a..007cd2b 100644 --- a/config.json.tmpl +++ b/config.json.tmpl @@ -3,10 +3,12 @@ "farm": true, "cookieSecret": "{{ env "COOKIE_SECRET" }}", "secure_cookie": true, - "security_type": "friends", + "security_type": "friends" + {{ if eq (env "FEDAWIKI_IS_PRIVATE") "1" }}, "wikiDomains": { "$DOMAIN": { "id": "/home/node/.wiki/config.owner.json" } } + {{ end }} } diff --git a/install.sh b/install.sh index c1a0e86..1cd1992 100644 --- a/install.sh +++ b/install.sh @@ -1,4 +1,11 @@ -cp -n config/config.json .wiki/config.json -cp -n config/config.owner.json .wiki/config.owner.json +#!/bin/sh + +if [ ! -f .wiki/config.json ]; then + cp config/config.json .wiki/config.json +fi + +if [ ! -f .wiki/config.owner.json ]; then + cp -n config/config.owner.json .wiki/config.owner.json +fi wiki --farm --security_type=friends