summaryrefslogtreecommitdiffstats
path: root/krebs/2configs
diff options
context:
space:
mode:
authorlassulus <git@lassul.us>2023-07-30 17:22:00 +0200
committerlassulus <git@lassul.us>2023-07-30 17:22:00 +0200
commitd8cdda91e3c8027ed8a057649b32e2a00d4abaf9 (patch)
tree3e42fcad2f92b9414f9982711f5ace63867dcaf1 /krebs/2configs
parent6043552115f1629b72fc40564eba4fd34f9a5cb6 (diff)
reaktor2: add hotdog.r/bedger.json endpoint
Diffstat (limited to 'krebs/2configs')
-rw-r--r--krebs/2configs/reaktor2.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix
index c357da1d7..0f7ab0adf 100644
--- a/krebs/2configs/reaktor2.nix
+++ b/krebs/2configs/reaktor2.nix
@@ -498,6 +498,36 @@ in {
'';
};
+ krebs.htgen.bedger = {
+ port = 8011;
+ user = {
+ name = "reaktor2";
+ home = stateDir;
+ };
+ script = ''. ${pkgs.writers.writeDash "bedger" ''
+ case "$Method" in
+ "GET")
+ printf 'HTTP/1.1 200 OK\r\n'
+ printf 'Connection: close\r\n'
+ printf '\r\n'
+ ${pkgs.hledger}/bin/hledger -f ${stateDir}/ledger bal -N -O json
+ exit
+ ;;
+ esac
+ ''}'';
+ };
+
+ services.nginx.virtualHosts."hotdog.r" = {
+ locations."/bedger.json".extraConfig = ''
+ proxy_set_header Host $host;
+ proxy_pass http://localhost:8011;
+ '';
+ extraConfig = ''
+ add_header 'Access-Control-Allow-Origin' '*';
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+ '';
+ };
+
systemd.services.reaktor2-r.serviceConfig.DynamicUser = mkForce false;
systemd.services.reaktor2-hackint.serviceConfig.DynamicUser = mkForce false;
krebs.reaktor2 = {