mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git
synced 2024-11-04 16:03:12 +00:00
Add Swagger to API package
This commit is contained in:
parent
b4bc3a4ffc
commit
8b5865c332
|
@ -25,6 +25,13 @@ in
|
|||
SelfPrivacy API token
|
||||
'';
|
||||
};
|
||||
enableSwagger = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Enable Swagger UI
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
|
@ -35,6 +42,7 @@ in
|
|||
HOME = "/root";
|
||||
PYTHONUNBUFFERED = "1";
|
||||
AUTH_TOKEN = cfg.token;
|
||||
ENABLE_SWAGGER = (if cfg.enableSwagger then "1" else "0");
|
||||
} // 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" ];
|
||||
|
|
|
@ -4,7 +4,7 @@ let
|
|||
inherit (nixpkgs) pkgs;
|
||||
inherit pythonPkgs;
|
||||
|
||||
selfprivacy-api = { buildPythonPackage, flask, flask-restful, setuptools, portalocker }:
|
||||
selfprivacy-api = { buildPythonPackage, flask, flask-restful, setuptools, portalocker, flask-swagger, flask-swagger-ui }:
|
||||
buildPythonPackage rec {
|
||||
pname = "selfprivacy-api";
|
||||
version = "1.1";
|
||||
|
@ -12,7 +12,7 @@ let
|
|||
url = "https://git.selfprivacy.org/ilchub/selfprivacy-rest-api.git";
|
||||
rev = "dbb4c1095654bba88d4f0c91b7b195d5262976b6";
|
||||
};
|
||||
propagatedBuildInputs = [ flask flask-restful setuptools portalocker ];
|
||||
propagatedBuildInputs = [ flask flask-restful setuptools portalocker flask-swagger flask-swagger-ui ];
|
||||
meta = {
|
||||
description = ''
|
||||
SelfPrivacy Server Management API
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
services.selfprivacy-api = {
|
||||
enable = true;
|
||||
token = config.services.userdata.api.token;
|
||||
enableSwagger = config.services.userdata.api.enableSwagger;
|
||||
};
|
||||
|
||||
users.users."selfprivacy-api" = {
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
"properties": {
|
||||
"token": {
|
||||
"type": "string"
|
||||
},
|
||||
"enableSwagger": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -44,6 +44,13 @@ in
|
|||
'';
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
enableSwagger = mkOption {
|
||||
default = true;
|
||||
description = ''
|
||||
Enable Swagger UI
|
||||
'';
|
||||
type = types.bool;
|
||||
};
|
||||
};
|
||||
backblaze = {
|
||||
bucket = mkOption {
|
||||
|
@ -132,7 +139,7 @@ in
|
|||
};
|
||||
rootKeys = mkOption {
|
||||
description = ''
|
||||
Root SSH Keys
|
||||
Root SSH Keys
|
||||
'';
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue