From 775d64dcb0c7f1fcd86b673c0b65775a2730881d Mon Sep 17 00:00:00 2001 From: Inex Code Date: Tue, 16 Nov 2021 19:05:05 +0300 Subject: [PATCH] Provide backup env vars to api --- api/api-module.nix | 21 +++++++++++++++++++++ api/api.nix | 3 +++ 2 files changed, 24 insertions(+) diff --git a/api/api-module.nix b/api/api-module.nix index 302f9d8..565d8de 100644 --- a/api/api-module.nix +++ b/api/api-module.nix @@ -32,6 +32,24 @@ in Enable Swagger UI ''; }; + b2AccountId = mkOption { + type = types.str; + description = '' + B2 account ID + ''; + }; + b2AccountKey = mkOption { + type = types.str; + description = '' + B2 account key + ''; + }; + resticPassword = mkOption { + type = types.str; + description = '' + Restic password + ''; + }; }; config = lib.mkIf cfg.enable { @@ -43,6 +61,9 @@ in PYTHONUNBUFFERED = "1"; AUTH_TOKEN = cfg.token; ENABLE_SWAGGER = (if cfg.enableSwagger then "1" else "0"); + B2_ACCOUNT_ID = cfg.b2AccountId; + B2_ACCOUNT_KEY = cfg.b2AccountKey; + RESTIC_PASSWORD = cfg.resticPassword; } // config.networking.proxy.envVars; path = [ "/var/" "/var/dkim/" pkgs.coreutils pkgs.gnutar pkgs.xz.bin pkgs.gzip pkgs.gitMinimal config.nix.package.out pkgs.nixos-rebuild pkgs.restic pkgs.mkpasswd ]; after = [ "network-online.target" ]; diff --git a/api/api.nix b/api/api.nix index f02f8bd..e503220 100644 --- a/api/api.nix +++ b/api/api.nix @@ -4,6 +4,9 @@ enable = true; token = config.services.userdata.api.token; enableSwagger = config.services.userdata.api.enableSwagger; + b2AccountId = config.services.userdata.backblaze.accountId; + b2AccountKey = config.services.userdata.backblaze.accountKey; + resticPassword = config.services.userdata.resticPassword; }; users.users."selfprivacy-api" = {