Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
Brawl345 committed Sep 7, 2024
1 parent e28f52f commit 496bb60
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
let
cfg = config.services.gobot;
defaultUser = "gobot";
inherit (lib) mkEnableOption mkMerge mkPackageOption mkOption mkIf types optionalAttrs;
inherit (lib) mkEnableOption mkMerge mkPackageOption mkOption mkIf types optionalAttrs optional optionalString;
in
{
options.services.gobot = {
Expand Down Expand Up @@ -144,7 +144,7 @@ in
script = ''
export BOT_TOKEN="$(< $CREDENTIALS_DIRECTORY/BOT_TOKEN )"
export MYSQL_PASSWORD="$(< $CREDENTIALS_DIRECTORY/MYSQL_PASSWORD )"
${lib.optionalString (cfg.useWebhook && cfg.webhookSecretFile != null) ''
${optionalString (cfg.useWebhook && cfg.webhookSecretFile != null) ''
export WEBHOOK_SECRET="$(< $CREDENTIALS_DIRECTORY/WEBHOOK_SECRET )"
''}
Expand All @@ -155,8 +155,8 @@ in
LoadCredential = [
"BOT_TOKEN:${cfg.botTokenFile}"
"MYSQL_PASSWORD:${cfg.database.passwordFile}"
(optionalAttrs (cfg.useWebhook && cfg.webhookSecretFile != null) "WEBHOOK_SECRET:${cfg.webhookSecretFile}")
];
] ++ optional (cfg.useWebhook && cfg.webhookSecretFile != null) "WEBHOOK_SECRET:${cfg.webhookSecretFile}";

Restart = "always";
User = cfg.user;
Group = defaultUser;
Expand All @@ -177,7 +177,7 @@ in
PORT = toString cfg.port;
WEBHOOK_PUBLIC_URL = cfg.webhookPublicUrl;
WEBHOOK_URL_PATH = cfg.webhookUrlPath;
WEBHOOK_SECRET = lib.optionalString (cfg.webhookSecret != null) cfg.webhookSecret;
WEBHOOK_SECRET = optionalString (cfg.webhookSecret != null) cfg.webhookSecret;
})
];
};
Expand Down

0 comments on commit 496bb60

Please sign in to comment.