[__matrix_synapse*] add --bind-address flag

This commit is contained in:
fnux 2021-02-19 11:25:16 +01:00
parent 028583f096
commit f27e65f8e0
No known key found for this signature in database
GPG Key ID: 4502C902C00A1E12
11 changed files with 49 additions and 9 deletions

View File

@ -1,8 +1,19 @@
#!/bin/sh
# Note: template originally generated from synapse's 1.26.0 sample config.
# Note: template originally generated from synapse's 1.26.0 sample config
set -e
generate_bind_addresses () {
if [ -n "$BIND_ADDRESSES" ]; then
echo "bind_addresses:"
for addr in $BIND_ADDRESSES; do
echo " - '$addr'"
done
else
echo "bind_addresses: []"
fi
}
cat << EOF
###############################################################
# THIS FILE HAS BEEN GENERATED BY CDIST. DO NOT EDIT BY HAND. #
@ -263,7 +274,7 @@ listeners:
tls: false
type: http
x_forwarded: true
bind_addresses: ['::1', '127.0.0.1']
$(generate_bind_addresses)
resources:
- names: ${MAIN_LISTENER_RESOURCES:?}
@ -273,7 +284,8 @@ EOF
if [ -n "$ENABLE_REPLICATION" ]; then
cat << EOF
- port: 9093
bind_addresses: ['::1', '127.0.0.1']
$(generate_bind_addresses)
type: http
resources:
- names: [replication]

View File

@ -167,6 +167,10 @@ registration-shared-secret
If set, allows registration of standard or admin accounts by anyone who
has the shared secret, even if registration is otherwise disabled.
bind-address
Address used to bind the synapse listeners. Can be specified multiple times.
Defaults to '::1' and '127.0.0.1'.
extra-setting
Arbitrary string to be added to the configuration file. Can be specified multiple times.

View File

@ -108,8 +108,9 @@ MAX_UPLOAD_SIZE=$(cat "$__object/parameter/max-upload-size")
EXPOSE_METRICS=$(get_boolean_for 'expose-metrics')
WEB_CLIENT_URL=$(cat "$__object/parameter/web-client-url")
ROOM_ENCRYPTION_POLICY=$(cat "$__object/parameter/room-encryption-policy")
BIND_ADDRESSES=$(cat "$__object/parameter/bind-address")
export SERVER_NAME BASE_URL REPORT_STATS MAX_UPLOAD_SIZE EXPOSE_METRICS \
WEB_CLIENT_URL ROOM_ENCRYPTION_POLICY
WEB_CLIENT_URL ROOM_ENCRYPTION_POLICY BIND_ADDRESSES
if [ -f "$__object/parameter/enable-server-notices" ]; then
export ENABLE_SERVER_NOTICES=1

View File

@ -0,0 +1 @@
::1 127.0.0.1

View File

@ -3,3 +3,4 @@ registration-allows-email-pattern
auto-join-room
app-service-config-file
extra-setting
bind-address

View File

@ -1,5 +1,16 @@
#!/bin/sh
generate_bind_addresses () {
if [ -n "$WORKER_BIND_ADDRESSES" ]; then
echo "bind_addresses:"
for addr in $WORKER_BIND_ADDRESSES; do
echo " - '$addr'"
done
else
echo "bind_addresses: []"
fi
}
cat << EOF
worker_app: "${WORKER_APP:?}"
worker_name: "${WORKER_NAME:?}"
@ -12,7 +23,7 @@ worker_listeners:
- type: http
port: ${WORKER_PORT:?}
x_forwarded: true
bind_addresses: ['::1', '127.0.0.1']
$(generate_bind_addresses)
resources:
- names:
EOF

View File

@ -27,9 +27,6 @@ app
port
Port on which this worker will listen.
resource
Resources to be served by this worker. Can be specified multiple times.
OPTIONAL PARAMETERS
-------------------
replication-host
@ -43,6 +40,15 @@ log-config
Path to log configuration. Defaults to synapse's main process log
configuration.
resource
Resources to be served by this worker. Can be specified multiple times.
Defaults to 'client' and 'federation'.
bind-address
Address used to bind the synapse listeners. Can be specified multiple times.
Defaults to '::1' and '127.0.0.1'.
EXAMPLES
--------

View File

@ -32,7 +32,8 @@ WORKER_NAME=$__object_id
WORKER_APP=$(cat "$__object/parameter/app")
WORKER_PORT=$(cat "$__object/parameter/port")
WORKER_RESOURCES=$(cat "$__object/parameter/resource")
export WORKER_APP WORKER_NAME WORKER_PORT WORKER_RESOURCES
WORKER_BIND_ADDRESSES=$(cat "$__object/parameter/bind-address")
export WORKER_APP WORKER_NAME WORKER_PORT WORKER_RESOURCES WORKER_BIND_ADDRESSES
if [ -f "$__object/parameter/log-config" ]; then
WORKER_LOG_CONFIG=$(cat "$__object/parameter/log-config")

View File

@ -0,0 +1 @@
::1 127.0.0.1

View File

@ -0,0 +1 @@
client federation

View File

@ -1 +1,2 @@
resource
bind-address