start.sh 1.1 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. set -e
  3. sed -i "s/SERVER_NAME/${SERVER_NAME}/g" /conf/homeserver.yaml
  4. # Add the application service registration files to the homeserver.yaml config
  5. for filename in /complement/appservice/*.yaml; do
  6. [ -f "$filename" ] || break
  7. as_id=$(basename "$filename" .yaml)
  8. # Insert the path to the registration file and the AS_REGISTRATION_FILES marker after
  9. # so we can add the next application service in the next iteration of this for loop
  10. sed -i "s/AS_REGISTRATION_FILES/ - \/complement\/appservice\/${as_id}.yaml\nAS_REGISTRATION_FILES/g" /conf/homeserver.yaml
  11. done
  12. # Remove the AS_REGISTRATION_FILES entry
  13. sed -i "s/AS_REGISTRATION_FILES//g" /conf/homeserver.yaml
  14. # generate an ssl key and cert for the server, signed by the complement CA
  15. openssl genrsa -out /conf/server.tls.key 2048
  16. openssl req -new -key /conf/server.tls.key -out /conf/server.tls.csr \
  17. -subj "/CN=${SERVER_NAME}"
  18. openssl x509 -req -in /conf/server.tls.csr \
  19. -CA /complement/ca/ca.crt -CAkey /complement/ca/ca.key -set_serial 1 \
  20. -out /conf/server.tls.crt
  21. exec python -m synapse.app.homeserver -c /conf/homeserver.yaml "$@"