nixos/miniflux: make admin provisioning optional
Miniflux supports provisioning users via SSO, which renders admin accounts unnecessary for some use-cases. This change retains the existing default, but makes it easier to disable admin provisioning.
This commit is contained in:
parent
730aa60b27
commit
f6788b6165
@ -49,7 +49,8 @@ in
|
||||
};
|
||||
|
||||
adminCredentialsFile = mkOption {
|
||||
type = types.path;
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
File containing the ADMIN_USERNAME and
|
||||
ADMIN_PASSWORD (length >= 6) in the format of
|
||||
@ -61,11 +62,16 @@ in
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{ assertion = cfg.config.CREATE_ADMIN == 0 || cfg.adminCredentialsFile != null;
|
||||
message = "services.miniflux.adminCredentialsFile must be set if services.miniflux.config.CREATE_ADMIN is 1";
|
||||
}
|
||||
];
|
||||
services.miniflux.config = {
|
||||
LISTEN_ADDR = mkDefault defaultAddress;
|
||||
DATABASE_URL = lib.mkIf cfg.createDatabaseLocally "user=miniflux host=/run/postgresql dbname=miniflux";
|
||||
RUN_MIGRATIONS = 1;
|
||||
CREATE_ADMIN = 1;
|
||||
CREATE_ADMIN = lib.mkDefault 1;
|
||||
WATCHDOG = 1;
|
||||
};
|
||||
|
||||
@ -103,7 +109,7 @@ in
|
||||
DynamicUser = true;
|
||||
RuntimeDirectory = "miniflux";
|
||||
RuntimeDirectoryMode = "0750";
|
||||
EnvironmentFile = cfg.adminCredentialsFile;
|
||||
EnvironmentFile = lib.mkIf (cfg.adminCredentialsFile != null) cfg.adminCredentialsFile;
|
||||
WatchdogSec = 60;
|
||||
WatchdogSignal = "SIGKILL";
|
||||
Restart = "always";
|
||||
|
Loading…
Reference in New Issue
Block a user