Provide backup env vars to api

This commit is contained in:
Inex Code 2021-11-16 19:05:05 +03:00
parent a2704e2717
commit 775d64dcb0
2 changed files with 24 additions and 0 deletions

View file

@ -32,6 +32,24 @@ in
Enable Swagger UI 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 { config = lib.mkIf cfg.enable {
@ -43,6 +61,9 @@ in
PYTHONUNBUFFERED = "1"; PYTHONUNBUFFERED = "1";
AUTH_TOKEN = cfg.token; AUTH_TOKEN = cfg.token;
ENABLE_SWAGGER = (if cfg.enableSwagger then "1" else "0"); 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; } // 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 ]; 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" ]; after = [ "network-online.target" ];

View file

@ -4,6 +4,9 @@
enable = true; enable = true;
token = config.services.userdata.api.token; token = config.services.userdata.api.token;
enableSwagger = config.services.userdata.api.enableSwagger; 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" = { users.users."selfprivacy-api" = {