Update module
This commit is contained in:
parent
9d75973ba7
commit
b7388520e0
21
module.nix
21
module.nix
|
@ -45,6 +45,23 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
database = {
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
description = mdDoc "MySQL host to connect to";
|
||||
example = "mysql.pvv.ntnu.no";
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
description = mdDoc "MySQL username to authenticate with";
|
||||
example = "calendar-bot";
|
||||
};
|
||||
passwordFile = mkOption {
|
||||
type = types.path;
|
||||
description = mdDoc "Path to file containing MySQL password";
|
||||
};
|
||||
};
|
||||
|
||||
secretsFile = mkOption {
|
||||
type = types.path;
|
||||
description = mdDoc "Path to secrets file that defines MATRIX_ACCESS_TOKEN";
|
||||
|
@ -81,11 +98,15 @@ in
|
|||
MATRIX_USER=${cfg.settings.matrix.user}
|
||||
ANNOUNCEMENT_CHANNEL=${cfg.settings.matrix.channel}
|
||||
MATRIX_TOKEN=@MATRIX_ACCESS_TOKEN@
|
||||
MYSQL_HOST=${cfg.settings.database.host}
|
||||
MYSQL_USER=${cfg.settings.database.user}
|
||||
MYSQL_PASSWORD=@MYSQL_PASSWORD@
|
||||
'';
|
||||
in
|
||||
''
|
||||
install -Dm600 ${envFile} /run/pvv-calendar-bot/env
|
||||
${pkgs.replace-secret}/bin/replace-secret '@MATRIX_ACCESS_TOKEN@' ${cfg.settings.secretsFile} /run/pvv-calendar-bot/env
|
||||
#${pkgs.replace-secret}/bin/replace-secret '@MYSQL_PASSWORD@' ${cfg.settings.database.passwordFile} /run/pvv-calendar-bot/env
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
|
|
Loading…
Reference in New Issue