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" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
WorkingDirectory = "/run/piped-backend";
|
WorkingDirectory = "/run/piped-backend";
|
||||||
ExecStartPre = "${pkgs.writeShellScript "piped-backend-init" ''
|
ExecStartPre = let
|
||||||
cp ${backend_config_file} /run/piped-backend/config.properties
|
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 ''
|
${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
|
'' else
|
||||||
""}
|
""}
|
||||||
${if (cfg.enableFederation && cfg.matrixTokenFile != "") then ''
|
${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
|
'' else
|
||||||
""}
|
""}
|
||||||
''}";
|
''}";
|
||||||
|
|
Loading…
Reference in a new issue