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/chloe | |
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/chloe')
-rw-r--r-- | virtual/modules/websites/chloe/chloe.nix | 28 | ||||
-rw-r--r-- | virtual/modules/websites/chloe/default.nix | 12 |
2 files changed, 18 insertions, 22 deletions
diff --git a/virtual/modules/websites/chloe/chloe.nix b/virtual/modules/websites/chloe/chloe.nix index ca34b5a..dcf076d 100644 --- a/virtual/modules/websites/chloe/chloe.nix +++ b/virtual/modules/websites/chloe/chloe.nix | |||
@@ -1,18 +1,10 @@ | |||
1 | { stdenv, lib, checkEnv, fetchzip, fetchurl, fetchedGitPrivate, sassc }: | 1 | { stdenv, lib, fetchzip, fetchurl, fetchedGitPrivate, sassc }: |
2 | let | 2 | let |
3 | chloe = { environment ? "dev" }: rec { | 3 | chloe = { config }: rec { |
4 | varPrefix = "CHLOE"; | 4 | environment = config.environment; |
5 | envName= lib.strings.toUpper environment; | ||
6 | phpFpm = rec { | 5 | phpFpm = rec { |
7 | socket = "/var/run/phpfpm/chloe-${environment}.sock"; | 6 | socket = "/var/run/phpfpm/chloe-${environment}.sock"; |
8 | pool = | 7 | pool = '' |
9 | assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_PASSWORD"; | ||
10 | assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_USER"; | ||
11 | assert checkEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_DB"; | ||
12 | assert checkEnv "NIXOPS_${varPrefix}_${envName}_LDAP_DN"; | ||
13 | assert checkEnv "NIXOPS_${varPrefix}_${envName}_LDAP_PASSWORD"; | ||
14 | assert checkEnv "NIXOPS_${varPrefix}_${envName}_LDAP_SEARCH"; | ||
15 | '' | ||
16 | listen = ${socket} | 8 | listen = ${socket} |
17 | user = ${apache.user} | 9 | user = ${apache.user} |
18 | group = ${apache.group} | 10 | group = ${apache.group} |
@@ -28,13 +20,13 @@ let | |||
28 | env[SPIP_SITE] = "chloe-${environment}" | 20 | env[SPIP_SITE] = "chloe-${environment}" |
29 | env[SPIP_LDAP_BASE] = "dc=immae,dc=eu" | 21 | env[SPIP_LDAP_BASE] = "dc=immae,dc=eu" |
30 | env[SPIP_LDAP_HOST] = "ldaps://ldap.immae.eu" | 22 | env[SPIP_LDAP_HOST] = "ldaps://ldap.immae.eu" |
31 | env[SPIP_LDAP_SEARCH_DN] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_LDAP_DN"}" | 23 | env[SPIP_LDAP_SEARCH_DN] = "${config.ldap.dn}" |
32 | env[SPIP_LDAP_SEARCH_PW] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_LDAP_PASSWORD"}" | 24 | env[SPIP_LDAP_SEARCH_PW] = "${config.ldap.password}" |
33 | env[SPIP_LDAP_SEARCH] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_LDAP_SEARCH"}" | 25 | env[SPIP_LDAP_SEARCH] = "${config.ldap.search}" |
34 | env[SPIP_MYSQL_HOST] = "db-1.immae.eu" | 26 | env[SPIP_MYSQL_HOST] = "db-1.immae.eu" |
35 | env[SPIP_MYSQL_DB] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_DB"}" | 27 | env[SPIP_MYSQL_DB] = "${config.mysql.name}" |
36 | env[SPIP_MYSQL_USER] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_USER"}" | 28 | env[SPIP_MYSQL_USER] = "${config.mysql.user}" |
37 | env[SPIP_MYSQL_PASSWORD] = "${builtins.getEnv "NIXOPS_${varPrefix}_${envName}_MYSQL_PASSWORD"}" | 29 | env[SPIP_MYSQL_PASSWORD] = "${config.mysql.password}" |
38 | ${if environment == "dev" then '' | 30 | ${if environment == "dev" then '' |
39 | pm = ondemand | 31 | pm = ondemand |
40 | pm.max_children = 5 | 32 | pm.max_children = 5 |
diff --git a/virtual/modules/websites/chloe/default.nix b/virtual/modules/websites/chloe/default.nix index de85e92..94cd4be 100644 --- a/virtual/modules/websites/chloe/default.nix +++ b/virtual/modules/websites/chloe/default.nix | |||
@@ -1,8 +1,12 @@ | |||
1 | { lib, pkgs, config, mylibs, ... }: | 1 | { lib, pkgs, config, myconfig, mylibs, ... }: |
2 | let | 2 | let |
3 | chloe = pkgs.callPackage ./chloe.nix { inherit (mylibs) checkEnv fetchedGitPrivate; }; | 3 | chloe = pkgs.callPackage ./chloe.nix { inherit (mylibs) fetchedGitPrivate; }; |
4 | chloe_dev = chloe { environment = "dev"; }; | 4 | chloe_dev = chloe { |
5 | chloe_prod = chloe { environment = "prod"; }; | 5 | config = myconfig.env.websites.chloe.integration; |
6 | }; | ||
7 | chloe_prod = chloe { | ||
8 | config = myconfig.env.websites.chloe.production; | ||
9 | }; | ||
6 | 10 | ||
7 | cfg = config.services.myWebsites.Chloe; | 11 | cfg = config.services.myWebsites.Chloe; |
8 | in { | 12 | in { |