summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/helsinki.at/rhimportd/main.go')
-rw-r--r--src/helsinki.at/rhimportd/main.go44
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() {