Merge pull request #1089 from DeterminateSystems/config/tracker

Fetch the tracker HTML from the config file, remove HYDRA_TRACKER
This commit is contained in:
Graham Christensen 2022-01-06 15:48:47 -05:00 committed by GitHub
commit f4e86a3236
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View file

@ -142,3 +142,12 @@ general any LDAP group of the form *hydra\_some\_role* (notice the
role_value: dn role_value: dn
role_search_options: role_search_options:
deref: always deref: always
Embedding Extra HTML
--------------------
Embed an analytics widget or other HTML in the `<head>` of each HTML document via:
```conf
tracker = <script src="...">
```

View file

@ -26,7 +26,7 @@ let
} // hydraEnv // cfg.extraEnv; } // hydraEnv // cfg.extraEnv;
serverEnv = env // serverEnv = env //
{ HYDRA_TRACKER = cfg.tracker; {
COLUMNS = "80"; COLUMNS = "80";
PGPASSFILE = "${baseDir}/pgpass-www"; # grrr PGPASSFILE = "${baseDir}/pgpass-www"; # grrr
XDG_CACHE_HOME = "${baseDir}/www/.cache"; XDG_CACHE_HOME = "${baseDir}/www/.cache";
@ -240,6 +240,14 @@ in
''} ''}
gc_roots_dir = ${cfg.gcRootsDir} gc_roots_dir = ${cfg.gcRootsDir}
use-substitutes = ${if cfg.useSubstitutes then "1" else "0"} use-substitutes = ${if cfg.useSubstitutes then "1" else "0"}
${optionalString (cfg.tracker != null) (let
indentedTrackerData = lib.concatMapStringsSep "\n" (line: " ${line}") (lib.splitString "\n" cfg.tracker);
in ''
tracker = <<TRACKER
${indentedTrackerData}
TRACKER
'')}
''; '';
environment.systemPackages = [ cfg.package ]; environment.systemPackages = [ cfg.package ];

View file

@ -49,7 +49,7 @@ sub begin :Private {
$c->stash->{nixVersion} = $ENV{"NIX_RELEASE"} || "<devel>"; $c->stash->{nixVersion} = $ENV{"NIX_RELEASE"} || "<devel>";
$c->stash->{curTime} = time; $c->stash->{curTime} = time;
$c->stash->{logo} = defined $c->config->{hydra_logo} ? "/logo" : ""; $c->stash->{logo} = defined $c->config->{hydra_logo} ? "/logo" : "";
$c->stash->{tracker} = $ENV{"HYDRA_TRACKER"}; $c->stash->{tracker} = defined $c->config->{tracker} ? $c->config->{tracker} : "";
$c->stash->{flashMsg} = $c->flash->{flashMsg}; $c->stash->{flashMsg} = $c->flash->{flashMsg};
$c->stash->{successMsg} = $c->flash->{successMsg}; $c->stash->{successMsg} = $c->flash->{successMsg};