Browse Source

systemd: populate SRS_DOMAIN default using postconf

Fixes #48
master
Dan Callaghan 8 years ago
parent
commit
731ef505e2
1 changed files with 11 additions and 1 deletions
  1. 11
    1
      init/postsrsd.systemd.in

+ 11
- 1
init/postsrsd.systemd.in View File

@@ -3,11 +3,21 @@ Description=PostSRSd Daemon
3 3
 
4 4
 [Service]
5 5
 Type=simple
6
+Restart=always
7
+
8
+# Fallback defaults.
6 9
 Environment=SRS_DOMAIN=localhost.localdomain
7 10
 Environment=SRS_EXCLUDE_DOMAINS=
11
+
12
+# Fill in a default value for SRS_DOMAIN using postconf.
13
+RuntimeDirectory=@PROJECT_NAME@
14
+ExecStartPre=/bin/sh -c '{ echo -n SRS_DOMAIN= ; postconf -h mydomain ; } >/run/@PROJECT_NAME@/default'
15
+EnvironmentFile=-/run/@PROJECT_NAME@/default
16
+
17
+# Load the real configuration.
8 18
 EnvironmentFile=@CONFIG_DIR@/@PROJECT_NAME@
19
+
9 20
 ExecStart=@CMAKE_INSTALL_PREFIX@/sbin/@POSTSRSD@ -f "${SRS_FORWARD_PORT}" -r "${SRS_REVERSE_PORT}" -d "${SRS_DOMAIN}" -s "${SRS_SECRET}" -a "${SRS_SEPARATOR}" -u "${RUN_AS}" -c "${CHROOT}" -X"${SRS_EXCLUDE_DOMAINS}"
10
-Restart=always
11 21
 
12 22
 [Install]
13 23
 WantedBy=multi-user.target

Loading…
Cancel
Save