Skip to content
Snippets Groups Projects
Commit f230e643 authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Shuffle the Grafana GSuite OAuth2 configuration around

This should let it work for both enabled and disabled configurations
parent 7b74652b
No related branches found
No related tags found
3 merge requests!140Merge staging into production,!122Merge develop into staging,!120Add GSuite SSO to Grafana
Pipeline #863 passed
...@@ -43,11 +43,35 @@ ...@@ -43,11 +43,35 @@
# See customize-issuer.nix for an explanatoin of targetHost value. # See customize-issuer.nix for an explanatoin of targetHost value.
deployment.targetHost = "${config.networking.hostName}.${config.networking.domain}"; deployment.targetHost = "${config.networking.hostName}.${config.networking.domain}";
deployment.secrets = { deployment.secrets = let
"monitoringvpn-private-key".source = "${privateKeyPath}/monitoringvpn/server.key"; # When Grafana SSO is disabled there is not necessarily any client secret
"monitoringvpn-preshared-key".source = "${privateKeyPath}/monitoringvpn/preshared.key"; # available. Avoid telling morph that there is one in this case (so it
"grafana-google-sso-secret".source = "${privateKeyPath}/grafana-google-sso.secret"; # avoids trying to read it and then failing). Even if the secret did
}; # exist, if SSO is disabled there's no point sending the secret to the
# server.
#
# Also, we have to define this whole secret here so that we can configure
# it completely or not at all. morph gets angry if we half configure it
# (say, by just omitting the "source" value).
grafanaSSO =
if googleOAuthClientID == ""
then { }
else {
"grafana-google-sso-secret" = {
source = "${privateKeyPath}/grafana-google-sso.secret";
destination = "/run/keys/grafana-google-sso.secret";
owner.user = "root";
owner.group = "root";
permissions = "0400";
action = ["sudo" "systemctl" "restart" "grafana.service"];
};
};
monitoringvpn = {
"monitoringvpn-private-key".source = "${privateKeyPath}/monitoringvpn/server.key";
"monitoringvpn-preshared-key".source = "${privateKeyPath}/monitoringvpn/preshared.key";
};
in
grafanaSSO // monitoringvpn;
networking.domain = domain; networking.domain = domain;
networking.hosts = hostsMap; networking.hosts = hostsMap;
......
...@@ -17,13 +17,6 @@ rec { ...@@ -17,13 +17,6 @@ rec {
permissions = "0400"; permissions = "0400";
action = ["sudo" "systemctl" "restart" "wireguard-monitoringvpn.service"]; action = ["sudo" "systemctl" "restart" "wireguard-monitoringvpn.service"];
}; };
"grafana-google-sso-secret" = {
destination = "/run/keys/grafana-google-sso.secret";
owner.user = "root";
owner.group = "root";
permissions = "0400";
action = ["sudo" "systemctl" "restart" "grafana.service"];
};
}; };
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment