nixos/photoprism: add databasePasswordFile option
This commit is contained in:
@@ -40,6 +40,14 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
databasePasswordFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Database password file.
|
||||
'';
|
||||
};
|
||||
|
||||
address = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "localhost";
|
||||
@@ -114,9 +122,12 @@ in
|
||||
cfg.storagePath
|
||||
];
|
||||
|
||||
LoadCredential = lib.optionalString (
|
||||
cfg.passwordFile != null
|
||||
) "PHOTOPRISM_ADMIN_PASSWORD_FILE:${cfg.passwordFile}";
|
||||
LoadCredential = [
|
||||
(lib.optionalString (cfg.passwordFile != null) "PHOTOPRISM_ADMIN_PASSWORD_FILE=${cfg.passwordFile}")
|
||||
(lib.optionalString (
|
||||
cfg.databasePasswordFile != null
|
||||
) "PHOTOPRISM_DATABASE_PASSWORD=${cfg.databasePasswordFile}")
|
||||
];
|
||||
|
||||
LockPersonality = true;
|
||||
PrivateDevices = true;
|
||||
@@ -151,6 +162,9 @@ in
|
||||
${lib.optionalString (cfg.passwordFile != null) ''
|
||||
export PHOTOPRISM_ADMIN_PASSWORD_FILE=$CREDENTIALS_DIRECTORY/PHOTOPRISM_ADMIN_PASSWORD_FILE
|
||||
''}
|
||||
${lib.optionalString (cfg.databasePasswordFile != null) ''
|
||||
export PHOTOPRISM_DATABASE_PASSWORD=$(cat "$CREDENTIALS_DIRECTORY/PHOTOPRISM_DATABASE_PASSWORD")
|
||||
''}
|
||||
exec ${cfg.package}/bin/photoprism migrations run -f
|
||||
'';
|
||||
|
||||
@@ -158,6 +172,9 @@ in
|
||||
${lib.optionalString (cfg.passwordFile != null) ''
|
||||
export PHOTOPRISM_ADMIN_PASSWORD_FILE=$CREDENTIALS_DIRECTORY/PHOTOPRISM_ADMIN_PASSWORD_FILE
|
||||
''}
|
||||
${lib.optionalString (cfg.databasePasswordFile != null) ''
|
||||
export PHOTOPRISM_DATABASE_PASSWORD=$(cat "$CREDENTIALS_DIRECTORY/PHOTOPRISM_DATABASE_PASSWORD")
|
||||
''}
|
||||
exec ${cfg.package}/bin/photoprism start
|
||||
'';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user