diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-22 12:49:20 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-22 12:49:20 +0100 |
commit | 9d90e7e281e8f4cf9371c17c812a1ac9c08aa66d (patch) | |
tree | 0b011ca0aeeef02dce03a3c825d9a037c5cfc01a /virtual/modules/websites/aten | |
parent | 0f3047a77ee1e0b3d943e39d50301ba85821c572 (diff) | |
download | Nix-9d90e7e281e8f4cf9371c17c812a1ac9c08aa66d.tar.gz Nix-9d90e7e281e8f4cf9371c17c812a1ac9c08aa66d.tar.zst Nix-9d90e7e281e8f4cf9371c17c812a1ac9c08aa66d.zip |
Remove use of environment variables
Fixes https://git.immae.eu/mantisbt/view.php?id=113
Diffstat (limited to 'virtual/modules/websites/aten')
-rw-r--r-- | virtual/modules/websites/aten/aten.nix | 20 | ||||
-rw-r--r-- | virtual/modules/websites/aten/default.nix | 12 |
2 files changed, 16 insertions, 16 deletions
diff --git a/virtual/modules/websites/aten/aten.nix b/virtual/modules/websites/aten/aten.nix index 7eec525..1520439 100644 --- a/virtual/modules/websites/aten/aten.nix +++ b/virtual/modules/websites/aten/aten.nix | |||
@@ -1,9 +1,8 @@ | |||
1 | { lib, checkEnv, writeText, fetchedGitPrivate, stdenv, php, git, cacert, phpPackages, yarn }: | 1 | { lib, writeText, fetchedGitPrivate, stdenv, php, git, cacert, phpPackages, yarn }: |
2 | let | 2 | let |
3 | aten = { environment ? "dev" }: rec { | 3 | aten = { config }: rec { |
4 | varPrefix = "ATEN"; | 4 | environment = config.environment; |
5 | varDir = "/var/lib/aten_${environment}"; | 5 | varDir = "/var/lib/aten_${environment}"; |
6 | envName= lib.strings.toUpper environment; | ||
7 | phpFpm = rec { | 6 | phpFpm = rec { |
8 | socket = "/var/run/phpfpm/aten-${environment}.sock"; | 7 | socket = "/var/run/phpfpm/aten-${environment}.sock"; |
9 | pool = '' | 8 | pool = '' |
@@ -34,17 +33,14 @@ let | |||
34 | user = "wwwrun"; | 33 | user = "wwwrun"; |
35 | group = "wwwrun"; | 34 | group = "wwwrun"; |
36 | modules = [ "proxy_fcgi" ]; | 35 | modules = [ "proxy_fcgi" ]; |
37 | vhostConf = | 36 | vhostConf = '' |
38 | assert checkEnv "NIXOPS_${varPrefix}_${envName}_SECRET"; | ||
39 | assert checkEnv "NIXOPS_${varPrefix}_${envName}_PSQL_URL"; | ||
40 | '' | ||
41 | <FilesMatch "\.php$"> | 37 | <FilesMatch "\.php$"> |
42 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" | 38 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" |
43 | </FilesMatch> | 39 | </FilesMatch> |
44 | 40 | ||
45 | SetEnv APP_ENV "${environment}" | 41 | SetEnv APP_ENV "${environment}" |
46 | SetEnv APP_SECRET "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_SECRET"} | 42 | SetEnv APP_SECRET "${config.secret}" |
47 | SetEnv DATABASE_URL "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_PSQL_URL"} | 43 | SetEnv DATABASE_URL "${config.psql_url}" |
48 | 44 | ||
49 | ${if environment == "dev" then '' | 45 | ${if environment == "dev" then '' |
50 | <Location /> | 46 | <Location /> |
@@ -96,8 +92,8 @@ let | |||
96 | export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt | 92 | export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt |
97 | export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt | 93 | export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt |
98 | export APP_ENV="${environment}" | 94 | export APP_ENV="${environment}" |
99 | export DATABASE_URL="${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_PSQL_URL"}" | 95 | export DATABASE_URL="${config.psql_url}" |
100 | export APP_SECRET="${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_SECRET"}" | 96 | export APP_SECRET="${config.secret}" |
101 | 97 | ||
102 | ${if environment == "dev" then '' | 98 | ${if environment == "dev" then '' |
103 | composer install | 99 | composer install |
diff --git a/virtual/modules/websites/aten/default.nix b/virtual/modules/websites/aten/default.nix index 2f319bb..db2ab49 100644 --- a/virtual/modules/websites/aten/default.nix +++ b/virtual/modules/websites/aten/default.nix | |||
@@ -1,8 +1,12 @@ | |||
1 | { lib, pkgs, config, mylibs, ... }: | 1 | { lib, pkgs, config, myconfig, mylibs, ... }: |
2 | let | 2 | let |
3 | aten = pkgs.callPackage ./aten.nix { inherit (mylibs) checkEnv fetchedGitPrivate; }; | 3 | aten = pkgs.callPackage ./aten.nix { inherit (mylibs) fetchedGitPrivate; }; |
4 | aten_dev = aten { environment = "dev"; }; | 4 | aten_dev = aten { |
5 | aten_prod = aten { environment = "prod"; }; | 5 | config = myconfig.env.websites.aten.integration; |
6 | }; | ||
7 | aten_prod = aten { | ||
8 | config = myconfig.env.websites.aten.production; | ||
9 | }; | ||
6 | 10 | ||
7 | cfg = config.services.myWebsites.Aten; | 11 | cfg = config.services.myWebsites.Aten; |
8 | in { | 12 | in { |