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