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