diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-01-05 16:39:25 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-01-05 16:39:25 (GMT) |
commit | 1f7c2b415a67049fa217ac1b7495e78267ec4808 (patch) | |
tree | 50c3c50ed83e9ae815d78d5edba3d8618e35e024 /src/helsinki.at/rhimportd/main.go | |
parent | 2383f77970c87504b96677e010a8aa954d6955f5 (diff) |
added initial watch-dir control interface
Diffstat (limited to 'src/helsinki.at/rhimportd/main.go')
-rw-r--r-- | src/helsinki.at/rhimportd/main.go | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/helsinki.at/rhimportd/main.go b/src/helsinki.at/rhimportd/main.go index 4bd779e..d941b05 100644 --- a/src/helsinki.at/rhimportd/main.go +++ b/src/helsinki.at/rhimportd/main.go @@ -70,6 +70,8 @@ func main() { flag.Var(webAddr, "web-addr", "addr:port to listen on (environment: RHIMPORTD_WEB_ADDR)") telnetAddr := newEnvStringValue("RHIMPORTD_TELNET_ADDR", "localhost:4023") flag.Var(telnetAddr, "telnet-addr", "addr:port to listen on (environment: RHIMPORTD_TELNET_ADDR)") + watchDir := newEnvStringValue("RHIMPORTD_WATCH_DIR", "") + flag.Var(watchDir, "watch-dir", "directory to look for file based requests (environment: RHIMPORTD_WATCH_DIR)") rdconf := newEnvStringValue("RHIMPORTD_RD_CONF", "/etc/rd.conf") flag.Var(rdconf, "rdconf", "path to the Rivendell config file (environment: RHIMPORTD_RD_CONF)") rdxportUrl := newEnvStringValue("RHIMPORTD_RDXPORT_URL", "http://localhost/rd-bin/rdxport.cgi") @@ -108,21 +110,35 @@ func main() { var wg sync.WaitGroup - wg.Add(1) - go func() { - defer wg.Done() - rhl.Println("starting web-ctrl") - StartControlWeb(webAddr.Get().(string), conf, rddb.GetInterface(), sessions.GetInterface()) - rhl.Println("web-ctrl finished") - }() + if webAddr.Get().(string) != "" { + wg.Add(1) + go func() { + defer wg.Done() + rhl.Println("starting web-ctrl") + StartControlWeb(webAddr.Get().(string), conf, rddb.GetInterface(), sessions.GetInterface()) + rhl.Println("web-ctrl finished") + }() + } - wg.Add(1) - go func() { - defer wg.Done() - rhl.Println("starting telnet-ctrl") - StartControlTelnet(telnetAddr.Get().(string), conf, rddb.GetInterface(), sessions.GetInterface()) - rhl.Println("telnet-ctrl finished") - }() + if telnetAddr.Get().(string) != "" { + wg.Add(1) + go func() { + defer wg.Done() + rhl.Println("starting telnet-ctrl") + StartControlTelnet(telnetAddr.Get().(string), conf, rddb.GetInterface(), sessions.GetInterface()) + rhl.Println("telnet-ctrl finished") + }() + } + + if watchDir.Get().(string) != "" { + wg.Add(1) + go func() { + defer wg.Done() + rhl.Println("starting watch-dir-ctrl") + StartWatchDir(watchDir.Get().(string), conf, rddb.GetInterface()) + rhl.Println("watch-dir-ctrl finished") + }() + } alldone := make(chan bool) go func() { |