mirror of
https://github.com/SaraSmiseth/prosody.git
synced 2025-04-19 16:01:14 +00:00
wip tests
This commit is contained in:
parent
d2065b426b
commit
1be1cc5bf7
9 changed files with 88 additions and 18 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
data/*
|
||||
data/*
|
||||
tests/certs/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
* Nothing
|
||||
* Fixed using list ENV variables with multiple values
|
||||
|
||||
## v1.1.2
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
local splitString = function(input, sep)
|
||||
local t={}
|
||||
for str in string.gmatch(input, "([^"..sep.."]+)") do
|
||||
table.insert(t, str)
|
||||
end
|
||||
return t
|
||||
end
|
||||
local stringy = require "stringy"
|
||||
|
||||
e2e_policy_chat = os.getenv("E2E_POLICY_CHAT")
|
||||
e2e_policy_muc = os.getenv("E2E_POLICY_MUC")
|
||||
e2e_policy_whitelist = splitString(os.getenv("E2E_POLICY_WHITELIST"), ", ")
|
||||
|
||||
local e2ePolicyWhitelist = os.getenv("E2E_POLICY_WHITELIST")
|
||||
print("e2ePolicyWhitelist:")
|
||||
print(e2ePolicyWhitelist)
|
||||
e2e_policy_whitelist = stringy.split(e2ePolicyWhitelist, ", ")
|
||||
|
||||
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."
|
||||
|
|
|
@ -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"), ", ");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "docker-entrypoint.sh"
|
||||
|
||||
export ALLOW_REGISTRATION=${ALLOW_REGISTRATION:-true}
|
||||
export DOMAIN_HTTP_UPLOAD=${DOMAIN_HTTP_UPLOAD:-"upload.$DOMAIN"}
|
||||
export DOMAIN_MUC=${DOMAIN_MUC:-"conference.$DOMAIN"}
|
||||
|
@ -21,7 +23,12 @@ export SERVER_CONTACT_INFO_SECURITY=${SERVER_CONTACT_INFO_SECURITY:-"xmpp:securi
|
|||
export SERVER_CONTACT_INFO_SUPPORT=${SERVER_CONTACT_INFO_SUPPORT:-"xmpp:support@$DOMAIN"}
|
||||
export PROSODY_ADMINS=${PROSODY_ADMINS:-""}
|
||||
|
||||
echo "docker-entrypoint.sh ENV variables initialized"
|
||||
|
||||
if [[ "$1" != "prosody" ]]; then
|
||||
echo "docker-entrypoint.sh prosodyctl"
|
||||
echo "docker-entrypoint.sh @ $@"
|
||||
echo "docker-entrypoint.sh * $*"
|
||||
exec prosodyctl $*
|
||||
exit 0;
|
||||
fi
|
||||
|
@ -35,5 +42,5 @@ if [ -z "$DOMAIN" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo "docker-entrypoint.sh last command"
|
||||
exec "$@"
|
||||
|
|
|
@ -1,11 +1,27 @@
|
|||
-- 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") };
|
||||
|
||||
print("Hello")
|
||||
print("World")
|
||||
print(os.getenv("PROSODY_ADMINS"));
|
||||
|
||||
local stringy = require "stringy"
|
||||
|
||||
print(stringy.split(os.getenv("PROSODY_ADMINS"), ","))
|
||||
print(stringy.split(os.getenv("PROSODY_ADMINS"), ", "))
|
||||
|
||||
admins = stringy.split(os.getenv("PROSODY_ADMINS"), ", ");
|
||||
|
||||
print(admins);
|
||||
|
||||
pidfile = "/var/run/prosody/prosody.pid"
|
||||
|
||||
use_libevent = true; -- improves performance
|
||||
|
||||
allow_registration = os.getenv("ALLOW_REGISTRATION");
|
||||
print("allow_registration:")
|
||||
print(allow_registration)
|
||||
|
||||
c2s_require_encryption = os.getenv("C2S_REQUIRE_ENCRYPTION");
|
||||
s2s_require_encryption = os.getenv("S2S_REQUIRE_ENCRYPTION");
|
||||
|
|
23
tests/docker-compose.yml
Normal file
23
tests/docker-compose.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
version: '3.7'
|
||||
|
||||
services:
|
||||
prosody:
|
||||
image: prosody
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "5000:5000"
|
||||
- "5222:5222"
|
||||
- "5223:5223"
|
||||
- "5269:5269"
|
||||
- "5281:5281"
|
||||
environment:
|
||||
DOMAIN: prosody
|
||||
PROSODY_ADMINS: "admin@prosody, admin2@prosody"
|
||||
extra_hosts:
|
||||
- "conference.prosody:127.0.0.1"
|
||||
- "pubsub.prosody:127.0.0.1"
|
||||
- "proxy.prosody:127.0.0.1"
|
||||
- "upload.prosody:127.0.0.1"
|
||||
volumes:
|
||||
- ./certs:/usr/local/etc/prosody/certs
|
||||
#- ./data:/usr/local/var/lib/prosody
|
18
tests/test.zsh
Executable file
18
tests/test.zsh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/zsh
|
||||
|
||||
# generate certs for testing
|
||||
|
||||
generateCert() {
|
||||
DOMAIN="$1"
|
||||
mkdir -p certs/"$DOMAIN"
|
||||
cd certs/"$DOMAIN"
|
||||
openssl req -x509 -newkey rsa:4096 -keyout privkey.pem -out fullchain.pem -days 365 -subj "/CN=$DOMAIN" -nodes
|
||||
chmod 777 *.pem
|
||||
cd ../../
|
||||
}
|
||||
|
||||
generateCert "prosody"
|
||||
generateCert "conference.prosody"
|
||||
generateCert "pubsub.prosody"
|
||||
generateCert "proxy.prosody"
|
||||
generateCert "upload.prosody"
|
Loading…
Reference in a new issue