diff options
| author | seth <[email protected]> | 2023-04-23 03:20:24 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-04-23 03:20:24 -0400 |
| commit | b336cdb0cdcdeff54bb7c28d11762d9be71d5de2 (patch) | |
| tree | 92ffa2dd081ce1f5324a4f7e5df3ac7d52002fd8 | |
| parent | 740cff7a2fb641c4f26673710459b8bc86f448ab (diff) | |
feat: add nix module
| -rw-r--r-- | nix/module.nix | 18 | ||||
| -rw-r--r-- | src/guzzle_api/api.py | 4 |
2 files changed, 17 insertions, 5 deletions
diff --git a/nix/module.nix b/nix/module.nix index 0dff2d0..e615561 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -5,9 +5,21 @@ ... }: let cfg = config.services.guzzle-api; - inherit (lib) mkDefault mkEnableOption mkIf; + inherit (lib) mkDefault mkEnableOption mkOption mkIf types; in { - options.services.guzzle-api.enable = mkEnableOption "enable guzzle-api"; + options.services.guzzle-api = { + enable = mkEnableOption "enable guzzle-api"; + url = mkOption { + type = types.string; + default = ""; + description = "url string for guzzle-api"; + }; + port = mkOption { + type = types.int; + default = 8080; + description = "port for guzzle-api"; + }; + }; config.systemd.services.guzzle-api = mkIf cfg.enable { guzzle-api = { @@ -16,7 +28,7 @@ in { wantedBy = ["multi-user.target"]; after = ["network.target"]; script = '' - ${pkgs.guzzle-api-server} --host 0.0.0.0 --port 8000 + URL=${cfg.url} ${pkgs.guzzle-api-server} --host 0.0.0.0 --port "${cfg.port}" ''; serviceConfig = mkDefault { Restart = "always"; diff --git a/src/guzzle_api/api.py b/src/guzzle_api/api.py index 180ceb6..76f25f7 100644 --- a/src/guzzle_api/api.py +++ b/src/guzzle_api/api.py @@ -1,11 +1,11 @@ +import os + from fastapi import FastAPI, Query from fastapi.staticfiles import StaticFiles from guzzle_api import lib from guzzle_api.teawie import lib as teawie -import os - URL = os.getenv("URL") TEAWIE_STATIC_ENDPOINT = "/static/teawie" |
