nixos/services.alerta: remove with lib;
This commit is contained in:
parent
59a4e8349e
commit
44990e93c3
@ -1,7 +1,4 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.alerta;
|
||||
|
||||
@ -12,7 +9,7 @@ let
|
||||
DATABASE_NAME = '${cfg.databaseName}'
|
||||
LOG_FILE = '${cfg.logDir}/alertad.log'
|
||||
LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
||||
CORS_ORIGINS = [ ${concatMapStringsSep ", " (s: "\"" + s + "\"") cfg.corsOrigins} ];
|
||||
CORS_ORIGINS = [ ${lib.concatMapStringsSep ", " (s: "\"" + s + "\"") cfg.corsOrigins} ];
|
||||
AUTH_REQUIRED = ${if cfg.authenticationRequired then "True" else "False"}
|
||||
SIGNUP_ENABLED = ${if cfg.signupEnabled then "True" else "False"}
|
||||
${cfg.extraConfig}
|
||||
@ -21,64 +18,64 @@ let
|
||||
in
|
||||
{
|
||||
options.services.alerta = {
|
||||
enable = mkEnableOption "alerta";
|
||||
enable = lib.mkEnableOption "alerta";
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 5000;
|
||||
description = "Port of Alerta";
|
||||
};
|
||||
|
||||
bind = mkOption {
|
||||
type = types.str;
|
||||
bind = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "0.0.0.0";
|
||||
description = "Address to bind to. The default is to bind to all addresses";
|
||||
};
|
||||
|
||||
logDir = mkOption {
|
||||
type = types.path;
|
||||
logDir = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = "Location where the logfiles are stored";
|
||||
default = "/var/log/alerta";
|
||||
};
|
||||
|
||||
databaseUrl = mkOption {
|
||||
type = types.str;
|
||||
databaseUrl = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "URL of the MongoDB or PostgreSQL database to connect to";
|
||||
default = "mongodb://localhost";
|
||||
};
|
||||
|
||||
databaseName = mkOption {
|
||||
type = types.str;
|
||||
databaseName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Name of the database instance to connect to";
|
||||
default = "monitoring";
|
||||
};
|
||||
|
||||
corsOrigins = mkOption {
|
||||
type = types.listOf types.str;
|
||||
corsOrigins = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
description = "List of URLs that can access the API for Cross-Origin Resource Sharing (CORS)";
|
||||
default = [ "http://localhost" "http://localhost:5000" ];
|
||||
};
|
||||
|
||||
authenticationRequired = mkOption {
|
||||
type = types.bool;
|
||||
authenticationRequired = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = "Whether users must authenticate when using the web UI or command-line tool";
|
||||
default = false;
|
||||
};
|
||||
|
||||
signupEnabled = mkOption {
|
||||
type = types.bool;
|
||||
signupEnabled = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = "Whether to prevent sign-up of new users via the web UI";
|
||||
default = true;
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
extraConfig = lib.mkOption {
|
||||
description = "These lines go into alertad.conf verbatim.";
|
||||
default = "";
|
||||
type = types.lines;
|
||||
type = lib.types.lines;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.tmpfiles.settings."10-alerta".${cfg.logDir}.d = {
|
||||
user = "alerta";
|
||||
group = "alerta";
|
||||
|
Loading…
Reference in New Issue
Block a user