Only take one grafana & prometheus host

This commit is contained in:
niten 2023-12-11 14:52:20 -08:00
parent 893538d442
commit 216e84c94e
2 changed files with 16 additions and 77 deletions

View File

@ -48,11 +48,20 @@ let
default = "admin@${domain}";
};
grafana-hosts = mkOption {
type = listOf str;
description =
"List of hosts acting as Grafana metric analyzers. Requires prometheus hosts as well.";
default = [ ];
metrics = mkOption {
type = nullOr (submodule {
options = {
grafanaHost = mkOption {
type = str;
description = "Hostname of the Grafana Metrics Analysis tool.";
};
prometheusHost = mkOption {
type = str;
description =
"Hostname of the Prometheus Metrics Aggregator tool.";
};
};
});
};
log-aggregator = mkOption {
@ -146,13 +155,6 @@ let
default = [ ];
};
prometheus-hosts = mkOption {
type = listOf str;
description =
"List of hosts acting aas prometheus metric scrapers for hosts in this network.";
default = [ ];
};
primary-nameserver = mkOption {
type = nullOr str;
description = "Hostname of the primary nameserver for this domain.";

View File

@ -105,28 +105,6 @@ in {
};
};
database = {
name = mkOption {
type = str;
description = "Database name.";
default = "grafana";
};
hostname = mkOption {
type = str;
description = "Hostname of the database server.";
default = "localhost";
};
user = mkOption {
type = str;
description = "Database username.";
default = "grafana";
};
password-file = mkOption {
type = str;
description = "File containing the database user's password.";
};
};
oauth = let
oauthOpts.options = {
hostname = mkOption {
@ -250,51 +228,10 @@ in {
};
database = {
host = cfg.database.hostname;
name = cfg.database.name;
user = cfg.database.user;
password = "$__file{${cfg.database.password-file}}";
type = "postgres";
ssl_mode = if cfg.private-network then "disable" else "require";
type = "sqlite3";
path = "${cfg.state-directory}/database.sqlite";
};
# "ldap.auth" = mkIf (cfg.ldap != null) (let
# base = cfg.ldap.base-dn;
# config-file = pkgs.writeText "grafana-ldap.toml" ''
# [[servers]]
# host = "${concatStringsSep " " cfg.ldap.hosts}"
# port = 389
# start_tls = true
# bind_dn = "uid=%s,ou=members,${base}"
# search_filter = "(uid=%s)"
# search_base_dns = [ "ou=members,${base}" ]
# group_search_filter = "(&(objectClass=posixGroup)(memberUid=%s))"
# group_search_base_dns = ["ou=groups,${base}"]
# group_search_filter_user_attribute = "uid"
# [[servers.group_mappings]]
# group_dn = "cn=admin,ou=groups,${base}"
# org_role = "Admin"
# grafana_admin = true
# [[servers.group_mappings]]
# group_dn = "cn=*,ou=groups,${base}"
# org_role = "Viewer"
# '';
# in {
# enabled = true;
# allow_sign_up = true;
# config_file = "${config-file}";
# # AUTH_LDAP_ENABLED = "true";
# # AUTH_LDAP_ALLOW_SIGN_UP = "true";
# # AUTH_LDAP_CONFIG_FILE = config-file;
# });
auth = mkIf (!isNull cfg.oauth) {
signout_redirect_url =
"https://${cfg.oauth.hostname}/application/o/${cfg.oauth.slug}/end-session/";