示例#1
0
func loadModules3rd(c *config.Config) []Module3rd {
	sections := c.Sections()
	var modules3rd []Module3rd
	for _, s := range sections {
		if s == config.DEFAULT_SECTION {
			continue
		}
		modules3rd = append(modules3rd, loadModule3rd(s, c))
	}
	return modules3rd
}
示例#2
0
func loadModule3rd(name string, c *config.Config) Module3rd {
	var module3rd Module3rd
	module3rd.Name = name
	module3rd.Form, _ = c.String(name, "form")
	module3rd.Url, _ = c.String(name, "url")
	module3rd.Rev, _ = c.String(name, "rev")
	module3rd.Shprov, _ = c.String(name, "shprov")
	module3rd.ShprovDir, _ = c.String(name, "shprovdir")
	return module3rd
}
示例#3
0
文件: main.go 项目: CloudAfrica/cip
func main() {

	flag.BoolVar(&verbose, "verbose", false, "See lots of stuff")
	confFile := flag.String("config", "", "Config file location")
	flag.Parse()

	var (
		protocol string
		host     string
		port     string
		db       string
		user     string
		password string
		err      error
		c        *config.Config
	)

	c, err = config.ReadDefault(*confFile)
	if err != nil {
		log.Print("No config file found, using defaults")
		protocol = "http://"
		host = "localhost"
		port = "8086"
		db = "events"
		user = "******"
		password = "******"
	} else {

		if protocol, err = c.RawStringDefault("protocol"); err != nil {
			protocol = "http://"
		}
		if host, err = c.RawStringDefault("host"); err != nil {
			host = "localhost"
		}
		if db, err = c.RawStringDefault("db"); err != nil {
			db = "events"
		}
		if user, err = c.RawStringDefault("user"); err != nil {
			user = "******"
		}
		if user, err = c.RawStringDefault("password"); err != nil {
			user = "******"
		}
	}

	influxUrl = protocol + host + ":" + port + "/db/" + db + "/series?u=" + user + "&p=" + password

	if verbose {
		log.Print("Starting proxy")
		log.Print("InfluxDB URL : " + influxUrl)
	}

	http.HandleFunc("/", handler)
	http.ListenAndServe(":8079", nil)
}