]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/ludivinecassal/production.nix
Upgrade nixos
[perso/Immae/Config/Nix.git] / modules / private / websites / ludivinecassal / production.nix
index 1a8b958c9874bd466af471c3ccb304fcb3b6c7ce..5761be7af22d352b08d536f502854d931f5997a6 100644 (file)
@@ -1,6 +1,6 @@
-{ lib, pkgs, config, myconfig,  ... }:
+{ lib, pkgs, config,  ... }:
 let
-  secrets = myconfig.env.websites.ludivinecassal.production;
+  secrets = config.myEnv.websites.ludivinecassal.production;
   app = pkgs.webapps.ludivinecassal.override { environment = secrets.environment; };
   pcfg = config.services.phpApplication;
   cfg = config.myServices.websites.ludivinecassal.production;
@@ -24,16 +24,16 @@ in {
         "./bin/console --env=${app.environment} cache:clear --no-warmup"
       ];
       phpOpenbasedir = [ "/tmp" ];
-      phpPool = ''
-        php_admin_value[upload_max_filesize] = 20M
-        php_admin_value[post_max_size] = 20M
-        ;php_admin_flag[log_errors] = on
-        pm = dynamic
-        pm.max_children = 20
-        pm.start_servers = 2
-        pm.min_spare_servers = 1
-        pm.max_spare_servers = 3
-      '';
+      phpPool = {
+        "php_admin_value[upload_max_filesize]" = "20M";
+        "php_admin_value[post_max_size]" = "20M";
+        #"php_admin_flag[log_errors]" = "on";
+        "pm" = "dynamic";
+        "pm.max_children" = "20";
+        "pm.start_servers" = "2";
+        "pm.min_spare_servers" = "1";
+        "pm.max_spare_servers" = "3";
+      };
       phpWatchFiles = [
         config.secrets.fullPaths."webapps/${app.environment}-ludivinecassal"
       ];
@@ -50,7 +50,7 @@ in {
           parameters:
               database_host: ${secrets.mysql.host}
               database_port: ${secrets.mysql.port}
-              database_name: ${secrets.mysql.name}
+              database_name: ${secrets.mysql.database}
               database_user: ${secrets.mysql.user}
               database_password: ${secrets.mysql.password}
               database_server_version: ${pkgs.mariadb.mysqlVersion}
@@ -68,7 +68,7 @@ in {
               ldap_base_dn: 'dc=immae,dc=eu'
               ldap_search_dn: '${secrets.ldap.dn}'
               ldap_search_password: '${secrets.ldap.password}'
-              ldap_search_filter: '${secrets.ldap.search}'
+              ldap_search_filter: '${secrets.ldap.filter}'
           leapt_im:
               binary_path: ${pkgs.imagemagick}/bin
           assetic:
@@ -85,6 +85,10 @@ in {
       root         = pcfg.webappDirs.ludivinecassal_prod;
       extraConfig  = [
         ''
+        RewriteEngine on
+        RewriteCond "%{HTTP_HOST}" "!^ludivinecassal\.com$" [NC]
+        RewriteRule ^(.+)$ https://ludivinecassal.com$1 [R=302,L]
+
         <FilesMatch "\.php$">
           SetHandler "proxy:unix:${pcfg.phpListenPaths.ludivinecassal_prod}|fcgi://localhost"
         </FilesMatch>