add environment file mechanism for secrets

This commit is contained in:
Jermeiah S 2025-06-14 07:55:32 -04:00
parent a14933388b
commit 088ac72632
No known key found for this signature in database

View file

@ -19,6 +19,10 @@ in
}; };
package = lib.mkPackageOption pkgs "otf" { }; package = lib.mkPackageOption pkgs "otf" { };
pgPackage = lib.mkPackageOption pkgs "postgresql_16" { }; pgPackage = lib.mkPackageOption pkgs "postgresql_16" { };
environmentFile = lib.mkEnableOption {
type = with lib.types; nullOr path;
default = lib.types.null;
};
# this application is configured entirely by environment variables and needs to be exposed # this application is configured entirely by environment variables and needs to be exposed
environment = lib.mkOption { environment = lib.mkOption {
type = type =
@ -85,6 +89,7 @@ in
WorkingDirectory = cfg.dataDir; WorkingDirectory = cfg.dataDir;
ExecStart = "${cfg.package}/bin/otfd"; ExecStart = "${cfg.package}/bin/otfd";
Restart = "on-failure"; Restart = "on-failure";
EnvironmentFile = lib.mkIf (cfg.environment.file != null) cfg.environment.file;
}; };
}; };
}; };