]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/aten/production.nix
Add specification for the private config file as a module.
[perso/Immae/Config/Nix.git] / modules / private / websites / aten / production.nix
index 2ffcef339f6cf4b607aad8ffdaae7f3ae966ec6f..1f72e61b9a15154d5ad2c365623527a35659278f 100644 (file)
@@ -1,6 +1,6 @@
-{ lib, pkgs, config, myconfig,  ... }:
+{ lib, pkgs, config,  ... }:
 let
-  secrets = myconfig.env.websites.aten.production;
+  secrets = config.myEnv.websites.aten.production;
   app = pkgs.webapps.aten.override { environment = secrets.environment; };
   cfg = config.myServices.websites.aten.production;
   pcfg = config.services.phpApplication;
@@ -8,7 +8,7 @@ in {
   options.myServices.websites.aten.production.enable = lib.mkEnableOption "enable Aten's website in production";
 
   config = lib.mkIf cfg.enable {
-    services.backup.profiles.aten_prod.rootDir = app.varDir;
+    services.duplyBackup.profiles.aten_prod.rootDir = app.varDir;
     services.webstats.sites = [ { name = "aten.pro"; } ];
     services.phpApplication.apps.aten_prod = {
       websiteEnv = "production";
@@ -41,10 +41,15 @@ in {
       user = config.services.httpd.Prod.user;
       group = config.services.httpd.Prod.group;
       permissions = "0400";
-      text = ''
+      text = let
+        # cf:
+        #   https://secure.php.net/manual/fr/function.parse-url.php
+        #   vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php#parseDatabaseUrlQuery
+        psql_url = with secrets.postgresql; "pdo-pgsql://${user}:${password}@invalid:${port}/${database}?host=${socket}";
+      in ''
         SetEnv APP_ENV      "${app.environment}"
         SetEnv APP_SECRET   "${secrets.secret}"
-        SetEnv DATABASE_URL "${secrets.psql_url}"
+        SetEnv DATABASE_URL "${psql_url}"
         '';
     }];
     services.websites.env.production.vhostConfs.aten_prod = {