From 357f4d40406301243d8bb364af21cdb8eec07215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sara=20Aim=C3=A9e=20Smiseth?= <51710585+SaraSmiseth@users.noreply.github.com> Date: Sat, 10 Oct 2020 08:55:43 +0200 Subject: [PATCH] Fix arrays with multiple values (#14) * fix arrays * Set pidfile in prosody.cfg.lua --- CHANGELOG.md | 3 ++- Dockerfile | 4 ++++ conf.d/03-e2e-policy.cfg.lua | 4 +++- conf.d/04-server_contact_info.cfg.lua | 14 ++++++++------ docker-entrypoint.sh | 1 - prosody.cfg.lua | 6 +++++- 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7e5b9e..fbc6d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## Unreleased -* Nothing +* Fixed using list ENV variables with multiple values +* Set pidfile in prosody.cfg.lua ## v1.1.2 diff --git a/Dockerfile b/Dockerfile index 0084280..7ce4469 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,6 +49,7 @@ RUN buildDeps='gcc git libc6-dev libidn11-dev liblua5.2-dev libsqlite3-dev libss && luarocks install luaevent \ && luarocks install luadbi \ && luarocks install luadbi-sqlite3 \ + && luarocks install stringy \ \ && apt-get purge -y --auto-remove $buildDeps @@ -58,6 +59,9 @@ RUN groupadd -r prosody \ && useradd -r -g prosody prosody \ && chown prosody:prosody /usr/local/var/lib/prosody +RUN mkdir -p /var/run/prosody/ \ + && chown prosody:prosody /var/run/prosody/ + # https://github.com/prosody/prosody-docker/issues/25 ENV __FLUSH_LOG yes diff --git a/conf.d/03-e2e-policy.cfg.lua b/conf.d/03-e2e-policy.cfg.lua index e296475..88a7ca8 100644 --- a/conf.d/03-e2e-policy.cfg.lua +++ b/conf.d/03-e2e-policy.cfg.lua @@ -1,6 +1,8 @@ +local stringy = require "stringy" + e2e_policy_chat = os.getenv("E2E_POLICY_CHAT") e2e_policy_muc = os.getenv("E2E_POLICY_MUC") -e2e_policy_whitelist = { os.getenv("E2E_POLICY_WHITELIST") } +e2e_policy_whitelist = stringy.split(os.getenv("E2E_POLICY_WHITELIST"), ", ") e2e_policy_message_optional_chat = "For security reasons, OMEMO, OTR or PGP encryption is STRONGLY recommended for conversations on this server." e2e_policy_message_required_chat = "For security reasons, OMEMO, OTR or PGP encryption is required for conversations on this server." e2e_policy_message_optional_muc = "For security reasons, OMEMO, OTR or PGP encryption is STRONGLY recommended for MUC on this server." diff --git a/conf.d/04-server_contact_info.cfg.lua b/conf.d/04-server_contact_info.cfg.lua index 6268d9d..52437e7 100644 --- a/conf.d/04-server_contact_info.cfg.lua +++ b/conf.d/04-server_contact_info.cfg.lua @@ -1,8 +1,10 @@ +local stringy = require "stringy" + contact_info = { - abuse = { os.getenv("SERVER_CONTACT_INFO_ABUSE") }; - admin = { os.getenv("SERVER_CONTACT_INFO_ADMIN") }; - feedback = { os.getenv("SERVER_CONTACT_INFO_FEEDBACK") }; - sales = { os.getenv("SERVER_CONTACT_INFO_SALES") }; - security = { os.getenv("SERVER_CONTACT_INFO_SECURITY") }; - support = { os.getenv("SERVER_CONTACT_INFO_SUPPORT") }; + abuse = stringy.split(os.getenv("SERVER_CONTACT_INFO_ABUSE"), ", "); + admin = stringy.split(os.getenv("SERVER_CONTACT_INFO_ADMIN"), ", "); + feedback = stringy.split(os.getenv("SERVER_CONTACT_INFO_FEEDBACK"), ", "); + sales = stringy.split(os.getenv("SERVER_CONTACT_INFO_SALES"), ", "); + security = stringy.split(os.getenv("SERVER_CONTACT_INFO_SECURITY"), ", "); + support = stringy.split(os.getenv("SERVER_CONTACT_INFO_SUPPORT"), ", "); } diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index fe02b5c..a7090d3 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -35,5 +35,4 @@ if [ -z "$DOMAIN" ]; then exit 1 fi - exec "$@" diff --git a/prosody.cfg.lua b/prosody.cfg.lua index 9b887b8..f0b0f3c 100644 --- a/prosody.cfg.lua +++ b/prosody.cfg.lua @@ -1,7 +1,11 @@ -- see example config at https://hg.prosody.im/0.9/file/0.9.10/prosody.cfg.lua.dist -- easily extendable by putting into different config files within conf.d folder -admins = { os.getenv("PROSODY_ADMINS") }; +local stringy = require "stringy" + +admins = stringy.split(os.getenv("PROSODY_ADMINS"), ", "); + +pidfile = "/var/run/prosody/prosody.pid" use_libevent = true; -- improves performance