change PreStartScript of piped to ensure correct file permissions
This commit is contained in:
parent
6063ef1f28
commit
b48a64a1ef
|
@ -54,14 +54,18 @@ in {
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
WorkingDirectory = "/run/piped-backend";
|
||||
ExecStartPre = "${pkgs.writeShellScript "piped-backend-init" ''
|
||||
cp ${backend_config_file} /run/piped-backend/config.properties
|
||||
ExecStartPre = let
|
||||
confFile = "/run/piped-backend/config.properties";
|
||||
in "${pkgs.writeShellScript "piped-backend-init" ''
|
||||
[ -f "${confFile}" ] && rm ${confFile}
|
||||
cp ${backend_config_file} ${confFile}
|
||||
chmod 660 ${confFile}
|
||||
${if (cfg.enableCaptcha && cfg.captchaAPIKeyFile != "") then ''
|
||||
sed -i "s/CAPTCHA_API_KEY_FILE/$(cat cfg.captchaAPIKeyFile | sed "s#/#\\\/#")/" /run/piped-backend/config.properties
|
||||
sed -i "s/CAPTCHA_API_KEY_FILE/$(cat cfg.captchaAPIKeyFile | sed "s#/#\\\/#")/" ${confFile}
|
||||
'' else
|
||||
""}
|
||||
${if (cfg.enableFederation && cfg.matrixTokenFile != "") then ''
|
||||
sed -i "s/MATRIX_TOKEN_FILE/$(cat cfg.matrixTokenFile | sed "s#/#\\\/#")/" /run/piped-backend/config.properties
|
||||
sed -i "s/MATRIX_TOKEN_FILE/$(cat cfg.matrixTokenFile | sed "s#/#\\\/#")/" ${confFile}
|
||||
'' else
|
||||
""}
|
||||
''}";
|
||||
|
|
Loading…
Reference in a new issue