elnudrop: host images API, refactoring

inky
Elnu 1 year ago
parent c393cbb98f
commit 65ae45eaaf

@ -6,11 +6,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1691779970,
"narHash": "sha256-NMrLx5FJ/ueTw4FYKqZ9FBh+H1fVXnAs7Vvr+9By8N0=",
"lastModified": 1691873908,
"narHash": "sha256-37XNMWtoca8zjNdGq95hbi6idB9pdbv2peqNvFxqfrM=",
"ref": "refs/heads/main",
"rev": "e90adfaf87c68785af0f66becb0d5c8fc59b9e2f",
"revCount": 15,
"rev": "412ca4e53890761467de233cf0ed37bebbc8eeac",
"revCount": 27,
"type": "git",
"url": "https://git.elnu.com/jichan.org/apis.git"
},
@ -156,11 +156,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1691472822,
"narHash": "sha256-XVfYZ2oB3lNPVq6sHCY9WkdQ8lHoIDzzbpg8bB6oBxA=",
"lastModified": 1691654369,
"narHash": "sha256-gSILTEx1jRaJjwZxRlnu3ZwMn1FVNk80qlwiCX8kmpo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "41c7605718399dcfa53dd7083793b6ae3bc969ff",
"rev": "ce5e4a6ef2e59d89a971bc434ca8ca222b9c7f5e",
"type": "github"
},
"original": {
@ -321,11 +321,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1691591308,
"narHash": "sha256-eeErUrPWCQwFHESL3vpNwkl8oyJPV6SRrVS9cPTEvYI=",
"lastModified": 1691806075,
"narHash": "sha256-yuq7cNkFOQse4WwLw0rUiXhG58aI6eyXKfcTw5Act/I=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "094512d7a7573ae2cb6db1a5ce4745a69b16fa46",
"rev": "b87a7db512340dea25e95f444db29e9264ff7a63",
"type": "github"
},
"original": {

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

@ -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;
'';
};
};
};
}

@ -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;
'';
};
}

@ -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;
'';
};
}
Loading…
Cancel
Save