[__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 #!/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 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 cat << EOF
############################################################### ###############################################################
# THIS FILE HAS BEEN GENERATED BY CDIST. DO NOT EDIT BY HAND. # # THIS FILE HAS BEEN GENERATED BY CDIST. DO NOT EDIT BY HAND. #
@ -263,7 +274,7 @@ listeners:
tls: false tls: false
type: http type: http
x_forwarded: true x_forwarded: true
bind_addresses: ['::1', '127.0.0.1'] $(generate_bind_addresses)
resources: resources:
- names: ${MAIN_LISTENER_RESOURCES:?} - names: ${MAIN_LISTENER_RESOURCES:?}
@ -273,7 +284,8 @@ EOF
if [ -n "$ENABLE_REPLICATION" ]; then if [ -n "$ENABLE_REPLICATION" ]; then
cat << EOF cat << EOF
- port: 9093 - port: 9093
bind_addresses: ['::1', '127.0.0.1'] $(generate_bind_addresses)
type: http type: http
resources: resources:
- names: [replication] - names: [replication]

View file

@ -167,6 +167,10 @@ registration-shared-secret
If set, allows registration of standard or admin accounts by anyone who If set, allows registration of standard or admin accounts by anyone who
has the shared secret, even if registration is otherwise disabled. 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 extra-setting
Arbitrary string to be added to the configuration file. Can be specified multiple times. 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') EXPOSE_METRICS=$(get_boolean_for 'expose-metrics')
WEB_CLIENT_URL=$(cat "$__object/parameter/web-client-url") WEB_CLIENT_URL=$(cat "$__object/parameter/web-client-url")
ROOM_ENCRYPTION_POLICY=$(cat "$__object/parameter/room-encryption-policy") 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 \ 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 if [ -f "$__object/parameter/enable-server-notices" ]; then
export ENABLE_SERVER_NOTICES=1 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 auto-join-room
app-service-config-file app-service-config-file
extra-setting extra-setting
bind-address

View file

@ -1,5 +1,16 @@
#!/bin/sh #!/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 cat << EOF
worker_app: "${WORKER_APP:?}" worker_app: "${WORKER_APP:?}"
worker_name: "${WORKER_NAME:?}" worker_name: "${WORKER_NAME:?}"
@ -12,7 +23,7 @@ worker_listeners:
- type: http - type: http
port: ${WORKER_PORT:?} port: ${WORKER_PORT:?}
x_forwarded: true x_forwarded: true
bind_addresses: ['::1', '127.0.0.1'] $(generate_bind_addresses)
resources: resources:
- names: - names:
EOF EOF

View file

@ -27,9 +27,6 @@ app
port port
Port on which this worker will listen. Port on which this worker will listen.
resource
Resources to be served by this worker. Can be specified multiple times.
OPTIONAL PARAMETERS OPTIONAL PARAMETERS
------------------- -------------------
replication-host replication-host
@ -43,6 +40,15 @@ log-config
Path to log configuration. Defaults to synapse's main process log Path to log configuration. Defaults to synapse's main process log
configuration. 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 EXAMPLES
-------- --------

View file

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