VEGAS/monitoring: extraOptions -> settings

This commit is contained in:
Max Headroom 2022-12-17 20:22:49 +01:00
parent 49e1b408be
commit 8ccb1477db

View file

@ -8,22 +8,7 @@ let
cfg = { inherit (config.services) loki; }; cfg = { inherit (config.services) loki; };
toString' = v: iniList = lib.concatStringsSep " ";
if v == true then "true" else
if v == false then "false" else
toString v;
mapPaths = lib.mapAttrsRecursive (
path: value: lib.nameValuePair
(lib.toUpper (lib.concatStringsSep "_" path))
(toString' value)
);
translateConfig = config: lib.listToAttrs (
lib.collect
(x: x ? name && x ? value)
(mapPaths config)
);
login = x: "https://login.${domain}/auth/realms/master/protocol/openid-connect/${x}"; login = x: "https://login.${domain}/auth/realms/master/protocol/openid-connect/${x}";
in in
@ -49,15 +34,15 @@ in
rootUrl = "https://monitoring.${domain}/"; rootUrl = "https://monitoring.${domain}/";
dataDir = "/srv/storage/private/grafana"; dataDir = "/srv/storage/private/grafana";
analytics.reporting.enable = false; analytics.reporting.enable = false;
extraOptions = translateConfig { settings = {
auth.generic_oauth = { "auth.generic_oauth" = {
enabled = true; enabled = true;
allow_sign_up = true; allow_sign_up = true;
client_id = "net.privatevoid.monitoring1"; client_id = "net.privatevoid.monitoring1";
auth_url = login "auth"; auth_url = login "auth";
token_url = login "token"; token_url = login "token";
api_url = login "userinfo"; api_url = login "userinfo";
scopes = [ "openid" "profile" "email" "roles" ]; scopes = iniList [ "openid" "profile" "email" "roles" ];
role_attribute_strict = true; role_attribute_strict = true;
role_attribute_path = "resource_access.monitoring.roles[0]"; role_attribute_path = "resource_access.monitoring.roles[0]";
}; };
@ -65,7 +50,7 @@ in
cookie_secure = true; cookie_secure = true;
disable_gravatar = true; disable_gravatar = true;
}; };
feature_toggles.enable = [ feature_toggles.enable = iniList [
"tempoSearch" "tempoSearch"
"tempoBackendSearch" "tempoBackendSearch"
"tempoServiceGraph" "tempoServiceGraph"