elnudrop: host images API, refactoring

This commit is contained in:
Elnu 2023-08-12 14:05:54 -07:00
parent c393cbb98f
commit 65ae45eaaf
5 changed files with 36 additions and 30 deletions

View file

@ -39,6 +39,4 @@
};
services.do-agent.enable = true;
services.tatoeba.enable = true;
}

View file

@ -1,6 +1,10 @@
{ enableSSL, ... }:
let host = "jichan.org"; in {
imports = [
./tatoeba.nix
./images.nix
];
services.nginx.virtualHosts."www.${host}" = {
forceSSL = enableSSL;
enableACME = enableSSL;
@ -17,24 +21,6 @@ let host = "jichan.org"; in {
"/502.html".root = "${./502}";
"/logo.svg".root = "${./502}";
"/missing.min.css".root = "${../shared/502}";
# Formerly tatoeba.elnu.com
# https://git.elnu.com/jichan.org/apis
"/api/tatoeba/" = {
proxyPass = "http://localhost:3001";
extraConfig = ''
rewrite ^/api/tatoeba/(.*) /$1 break;
'';
};
# Formerly images.elnu.com
# https://git.elnu.com/jichan.org/apis
"/api/images/" = {
proxyPass = "http://localhost:3002";
extraConfig = ''
rewrite ^/api/images/(.*) /$1 break;
'';
};
};
};
}

View file

@ -0,0 +1,11 @@
{ config, ... }:
{
services.images.enable = true;
services.nginx.virtualHosts."jichan.org".locations."/api/images" = {
proxyPass = "http://localhost:${builtins.toString config.services.images.port}";
extraConfig = ''
rewrite ^/api/images/(.*) /$1 break;
'';
};
}

View file

@ -0,0 +1,11 @@
{ config, ... }:
{
services.tatoeba.enable = true;
services.nginx.virtualHosts."jichan.org".locations."/api/tatoeba" = {
proxyPass = "http://localhost:${builtins.toString config.services.tatoeba.port}";
extraConfig = ''
rewrite ^/api/tatoeba/(.*) /$1 break;
'';
};
}