From 744f212b262e90f28b414c506c39b53838d571d9 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 28 Mar 2019 17:35:30 +0100 Subject: [PATCH] keep config.js in config/ and persist it via various docker mechanisms --- Dockerfile | 1 + config.example.js => config/config.example.js | 0 container-start.sh | 5 +---- docker-compose.yml | 1 + server.js | 6 +++--- 5 files changed, 6 insertions(+), 7 deletions(-) rename config.example.js => config/config.example.js (100%) diff --git a/Dockerfile b/Dockerfile index 182eece52..6fd20a625 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ ENV STORAGE=\'./storage/file\' ENV LOG_TO_STDOUT=true # Persistent storage needs +VOLUME /cryptpad/config VOLUME /cryptpad/datastore VOLUME /cryptpad/customize VOLUME /cryptpad/blobstage diff --git a/config.example.js b/config/config.example.js similarity index 100% rename from config.example.js rename to config/config.example.js diff --git a/container-start.sh b/container-start.sh index 382e9768d..7cbbf3143 100755 --- a/container-start.sh +++ b/container-start.sh @@ -4,10 +4,7 @@ mkdir -p customize # Copying default config -[ ! -h customize/config.js ] && echo "Creating config.js" && cp config.example.js customize/config.js - -# Linking config.js -[ ! -h config.js ] && echo "Linking config.js" && ln -s customize/config.js config.js +[ ! -f config/config.js ] && echo "Creating config.js" && cp config/config.example.js config/config.js # Thanks to http://stackoverflow.com/a/10467453 sedeasy() { diff --git a/docker-compose.yml b/docker-compose.yml index fab74870a..e0357287d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,3 +26,4 @@ services: - ./data/blobstage:/cryptpad/blobstage:rw - ./data/tasks:/cryptpad/tasks:rw - ./data/block:/cryptpad/block:rw + - ./data/config:/cryptpad/config:rw diff --git a/server.js b/server.js index 42a4c62fd..0158c1b68 100644 --- a/server.js +++ b/server.js @@ -13,10 +13,10 @@ var nThen = require("nthen"); var config; try { - config = require('./config'); + config = require('./config/config'); } catch (e) { - console.log("You can customize the configuration by copying config.example.js to config.js"); - config = require('./config.example'); + console.log("You can customize the configuration by copying config/config.example.js to config/config.js"); + config = require('./config/config.example'); } var websocketPort = config.websocketPort || config.httpPort; var useSecureWebsockets = config.useSecureWebsockets || false;