summaryrefslogtreecommitdiff
path: root/src/rhctl/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/rhctl/main.go')
-rw-r--r--src/rhctl/main.go60
1 files changed, 28 insertions, 32 deletions
diff --git a/src/rhctl/main.go b/src/rhctl/main.go
index f6742d8..14a86bc 100644
--- a/src/rhctl/main.go
+++ b/src/rhctl/main.go
@@ -27,7 +27,6 @@ import (
"io/ioutil"
"log"
"os"
- "time"
)
var (
@@ -61,8 +60,8 @@ func (s *envStringValue) Get() interface{} { return string(*s) }
func (s *envStringValue) String() string { return fmt.Sprintf("%s", *s) }
func main() {
- webAddr := newEnvStringValue("RHCTL_WEB_ADDR", "localhost:4080")
- flag.Var(webAddr, "web-addr", "addr:port to listen on (environment: RHCTL_WEB_ADDR)")
+ configFile := newEnvStringValue("RHCTL_CONFIG_FILE", "/etc/rhctl/config.toml")
+ flag.Var(configFile, "conf", "path to the configuration file (environment: RHCTL_CONFIG_FILE)")
help := flag.Bool("help", false, "show usage")
flag.Parse()
@@ -71,37 +70,34 @@ func main() {
return
}
- if webAddr.Get().(string) != "" {
- go func() {
- rhl.Println("starting web-api:", webAddr.Get().(string))
- for {
- time.Sleep(time.Second)
- }
- //StartWeb(webAddr.Get().(string))
- rhl.Println("web-api finished")
- }()
- }
-
- sw, err := SwitchInit("/dev/ttyUSB0", B9600)
- if err != nil {
- rhl.Println("error audio switch: ", err)
- return
- }
-
- master, err := ServerInit("master", "/dev/ttyUSB1", "/dev/ttyUSB2", B38400)
- if err != nil {
- rhl.Println("error master server: ", err)
- return
- }
-
- standby, err := ServerInit("standby", "/dev/ttyUSB3", "/dev/ttyUSB4", B38400)
+ conf, err := ReadConfig(configFile.Get().(string))
if err != nil {
- rhl.Println("error standby server: ", err)
+ rhl.Println("Error reading configuration:", err.Error())
return
}
- sw.Run()
- master.Run()
- standby.Run()
- time.Sleep(time.Second)
+ rhdl.Printf("config: %+v", conf)
+
+ // sw, err := SwitchInit("/dev/ttyUSB0", B9600)
+ // if err != nil {
+ // rhl.Println("error audio switch: ", err)
+ // return
+ // }
+
+ // master, err := ServerInit("master", "/dev/ttyUSB1", "/dev/ttyUSB2", B38400)
+ // if err != nil {
+ // rhl.Println("error master server: ", err)
+ // return
+ // }
+
+ // standby, err := ServerInit("standby", "/dev/ttyUSB3", "/dev/ttyUSB4", B38400)
+ // if err != nil {
+ // rhl.Println("error standby server: ", err)
+ // return
+ // }
+
+ // sw.Run()
+ // master.Run()
+ // standby.Run()
+ // time.Sleep(time.Second)
}