-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
417a005
commit 43a2423
Showing
4 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/sh | ||
|
||
function read_var() { | ||
if [ -z "$1" ]; then | ||
echo "environment variable name is required" | ||
return 1 | ||
fi | ||
|
||
local ENV_FILE='.env.docker' | ||
if [ ! -z "$2" ]; then | ||
ENV_FILE="$2" | ||
fi | ||
|
||
grep $1 $ENV_FILE | grep -v -P '^\s*#' | cut -d '=' -f 2- | ||
} | ||
|
||
function set_yaml_value() | ||
{ | ||
yaml_file=$1 | ||
key=$2 | ||
new_value=$3 | ||
|
||
sed -r "s/^(\s*${key}\s*:\s*).*/\1${new_value}/" -i "$yaml_file" | ||
} | ||
|
||
function enable_registration() | ||
{ | ||
pattern="enable_registration: false" | ||
echo $pattern | ||
replacement="enable_registration: true" | ||
echo $replacement | ||
sed -i "s/${pattern}/${replacement}/g" "/var/docker_data/matrix/homeserver.yaml" | ||
sed -i '/enable_registration:/s/^#//g' "/var/docker_data/matrix/homeserver.yaml" | ||
} | ||
|
||
docker run -it --rm \ | ||
--mount type=volume,src=synapse-data,dst=/data \ | ||
-e SYNAPSE_SERVER_NAME=$(read_var SYNAPSE_SERVER_NAME) \ | ||
-e SYNAPSE_REPORT_STATS=yes \ | ||
matrixdotorg/synapse:latest generate | ||
|
||
cp -a /var/lib/docker/volumes/synapse-data/_data/. /var/docker_data/matrix | ||
|
||
set_yaml_value "/var/docker_data/matrix/homeserver.yaml" "registration_shared_secret" $(read_var SYNAPSE_SHARED_SECRET) | ||
enable_registration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters