summaryrefslogtreecommitdiff
path: root/overlays/ympd/ympd-password-env.patch
blob: 2bbe1886129f2be415facdeda5b2f260b9c88f67 (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
diff --git a/src/ympd.c b/src/ympd.c
index 3aed7e6..b3b6fda 100644
--- a/src/ympd.c
+++ b/src/ympd.c
@@ -71,6 +71,7 @@ int main(int argc, char **argv)
     char *run_as_user = NULL;
     char const *error_msg = NULL;
     char *webport = "8080";
+    const char *s;
 
     atexit(bye);
 #ifdef WITH_DYNAMIC_ASSETS
@@ -92,6 +93,10 @@ int main(int argc, char **argv)
         {0,              0,                 0,  0 }
     };
 
+    if ((s = getenv("MPD_PASSWORD")) != NULL) {
+        mpd.password = strdup(s);
+    }
+
     while((n = getopt_long(argc, argv, "h:p:w:u:vm:",
                 long_options, &option_index)) != -1) {
         switch (n) {