blob: 613a171c6c8275898f6a86cf479c3f888659cd8f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
{ env }:
let
ympd = rec {
config = {
webPort = "localhost:${env.listenPort}";
mpd = {
host = "${env.mpd.host} --mpdpass ${env.mpd.password}";
port = env.mpd.port;
};
};
apache = {
modules = [
"proxy_wstunnel"
];
vhostConf = ''
<LocationMatch "^/mpd(?!/music.(mp3|ogg))">
Use LDAPConnect
Require ldap-group cn=users,cn=mpd,ou=services,dc=immae,dc=eu
</LocationMatch>
RedirectMatch permanent "^/mpd$" "/mpd/"
<Location "/mpd/">
ProxyPass http://${config.webPort}/
ProxyPassReverse http://${config.webPort}/
ProxyPreserveHost on
</Location>
<Location "/mpd/ws">
ProxyPass ws://${config.webPort}/ws
</Location>
<Location "/mpd/music.mp3">
ProxyPass http://localhost:${env.mp3port}/
ProxyPassReverse http://localhost:${env.mp3port}/
</Location>
<Location "/mpd/music.ogg">
ProxyPass http://localhost:${env.oggport}/
ProxyPassReverse http://localhost:${env.oggport}/
</Location>
'';
};
};
in
ympd
|