-func parseArgs() {
- a := make(map[string]string)
- xmgeturl := flag.String("nbi-httpget", "http://localhost:3000/xapps", "xApp Manager URL")
- nngpubsock := flag.String("sbi-nngsub", "tcp://0.0.0.0:4560", "NNG Subsciption Socket URI")
- file := flag.String("sdl-file", "/db/rt.json", "Local file store location")
- rpename := flag.String("rpe", "rmr", "Policy Engine Module name")
- loglevel := flag.String("loglevel", "INFO", "INFO | WARN | ERROR | DEBUG")
- flag.Parse()
- if (*xmgeturl) != "" {
- a["xmurl"] = (*xmgeturl)
- a["nbiname"] = "httpGetter"
- }
- if (*nngpubsock) != "" {
- a["socketuri"] = (*nngpubsock)
- a["sbiname"] = "nngpub"
- }
- if (*file) != "" {
- a["file"] = (*file)
- a["sdlname"] = "file"
- }
- a["rpename"] = (*rpename)
- a["loglevel"] = (*loglevel)
- args = &a
+func SetupCloseHandler() {
+ c := make(chan os.Signal, 2)
+ signal.Notify(c, os.Interrupt, syscall.SIGTERM)
+ go func() {
+ <-c
+ xapp.Logger.Info("\r- Ctrl+C pressed in Terminal")
+ os.Exit(0)
+ }()