diff options
author | Franck Cuny <franck@fcuny.net> | 2022-04-13 14:04:45 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-04-13 14:04:45 -0700 |
commit | 13183d3bde442c2ab91bac100734efaf6995b8ef (patch) | |
tree | 61fe81e0b5392ddc9e3d972f76d270cab68c453b /modules/services/grafana | |
parent | grafana: bind to localhost (diff) | |
download | world-13183d3bde442c2ab91bac100734efaf6995b8ef.tar.gz |
grafana: the vhost is configurable
Diffstat (limited to 'modules/services/grafana')
-rw-r--r-- | modules/services/grafana/default.nix | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/modules/services/grafana/default.nix b/modules/services/grafana/default.nix index 20d5a19..bcb52e2 100644 --- a/modules/services/grafana/default.nix +++ b/modules/services/grafana/default.nix @@ -5,6 +5,11 @@ let in { options.my.services.grafana = with lib; { enable = mkEnableOption "grafana observability stack"; + vhostName = mkOption { + type = types.str; + example = "dash.fcuny.net"; + description = "Name for the virtual host"; + }; }; config = lib.mkIf cfg.enable { @@ -27,16 +32,18 @@ in { }; }; - services.nginx.virtualHosts."dash.fcuny.xyz" = { + services.nginx.virtualHosts."${cfg.vhostName}" = { forceSSL = true; - useACMEHost = "dash.fcuny.xyz"; + useACMEHost = cfg.vhostName; locations."/" = { - proxyPass = "http://127.0.0.1:3000"; + proxyPass = "http://${config.services.grafana.addr}:${ + toString config.services.grafana.port + }"; proxyWebsockets = true; }; }; - security.acme.certs."dash.fcuny.xyz" = { + security.acme.certs."${cfg.vhostName}" = { dnsProvider = "gcloud"; credentialsFile = secrets."acme/credentials".path; }; |