func test() { logger.SetLog(true, true, true) // load configs iniConfigs := config.ReadConfigIni("config.ini") LoadConfigs(&iniConfigs) Send("hello world") }
func LoadConfigs(iniConfigs *(map[string]map[string]string)) { auxIniConfigs := *iniConfigs var info bool = false var warn bool = false var err bool = false var host string = "" var port string = "" var user string = "" var pass string = "" // QueueConnection if auxIniConfigs["QueueConnection"]["queue_name"] != "" { configs.queueName = auxIniConfigs["QueueConnection"]["queue_name"] } if auxIniConfigs["QueueConnection"]["host"] != "" { host = auxIniConfigs["QueueConnection"]["host"] } if auxIniConfigs["QueueConnection"]["port"] != "" { port = auxIniConfigs["QueueConnection"]["port"] } if auxIniConfigs["QueueConnection"]["user"] != "" { user = auxIniConfigs["QueueConnection"]["user"] } if auxIniConfigs["QueueConnection"]["pass"] != "" { pass = auxIniConfigs["QueueConnection"]["pass"] } // amqp://guest:guest@localhost:5672/ configs.amqpUrl = "amqp://" + user + ":" + pass + "@" + host + ":" + port + "/" // LOG if auxIniConfigs["Log"]["info"] == "true" { info = true } if auxIniConfigs["Log"]["warning"] == "true" { warn = true } if auxIniConfigs["Log"]["error"] == "true" { err = true } logger.SetLog(info, warn, err) }
func LoadConfigs(iniConfigs *(map[string]map[string]string)) { auxIniConfigs := *iniConfigs var info bool = false var warn bool = false var err bool = false // RABBITMQ configs rabbitmq.LoadConfigs(&auxIniConfigs) // HTTP if auxIniConfigs["Http"]["success_response"] != "" { configs.successResponse = []byte(auxIniConfigs["Http"]["success_response"]) } if auxIniConfigs["Http"]["fail_response"] != "" { configs.failResponse = []byte(auxIniConfigs["Http"]["fail_response"]) } if auxIniConfigs["Http"]["Http_port"] != "" { configs.httpPort = auxIniConfigs["Http"]["Http_port"] } if auxIniConfigs["Http"]["url_path"] != "" { configs.urlPath = auxIniConfigs["Http"]["url_path"] } if auxIniConfigs["Http"]["input_regex_validation"] != "" { configs.inputRegexValidation = auxIniConfigs["Http"]["input_regex_validation"] } if auxIniConfigs["Http"]["parallel_send_to_queue"] == "true" { configs.parallelSendToQueue = true } // LOG if auxIniConfigs["Log"]["info"] == "true" { info = true } if auxIniConfigs["Log"]["warning"] == "true" { warn = true } if auxIniConfigs["Log"]["error"] == "true" { err = true } logger.SetLog(info, warn, err) }