mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(access): mpd
This commit is contained in:
parent
2340ca381d
commit
d699eea7ff
3 changed files with 85 additions and 0 deletions
73
nixos/access/mpd.nix
Normal file
73
nixos/access/mpd.nix
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkDefault;
|
||||
name.shortServer = mkDefault "radio";
|
||||
upstreamName = "radio'access";
|
||||
upstreamHigh = "${upstreamName}'high";
|
||||
upstreamLow = "${upstreamName}'low";
|
||||
in {
|
||||
config.services.nginx = {
|
||||
upstreams' = {
|
||||
${upstreamHigh} = {
|
||||
servers.service = {
|
||||
#accessService.system = "shanghai";
|
||||
addr = "shanghai.local.cutie.moe";
|
||||
port = 32101;
|
||||
};
|
||||
};
|
||||
${upstreamLow} = {
|
||||
servers.service = {
|
||||
#accessService.system = "shanghai";
|
||||
addr = "shanghai.local.cutie.moe";
|
||||
port = 32102;
|
||||
};
|
||||
};
|
||||
};
|
||||
virtualHosts = let
|
||||
copyFromVhost = mkDefault "mpd";
|
||||
extraConfig = ''
|
||||
proxy_buffering off;
|
||||
'';
|
||||
locations = {
|
||||
"/low" = {
|
||||
inherit extraConfig;
|
||||
proxy = {
|
||||
enable = true;
|
||||
upstream = mkDefault upstreamLow;
|
||||
};
|
||||
};
|
||||
"/high" = {
|
||||
inherit extraConfig;
|
||||
proxy = {
|
||||
enable = true;
|
||||
upstream = mkDefault upstreamHigh;
|
||||
};
|
||||
};
|
||||
"/" = {
|
||||
extraConfig = ''
|
||||
rewrite ^.*$ /high last;
|
||||
return 404;
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
mpd = {
|
||||
inherit name locations;
|
||||
proxy.upstream = mkDefault upstreamName;
|
||||
};
|
||||
mpd'local = {
|
||||
inherit name locations;
|
||||
ssl.cert = {
|
||||
inherit copyFromVhost;
|
||||
};
|
||||
proxy = {
|
||||
inherit copyFromVhost;
|
||||
};
|
||||
local.enable = mkDefault true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue