Esempio n. 1
0
File: main.go Progetto: hhshih/dogo
func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())

	var c string
	flag.StringVar(&c, "c", console.WorkingDir+"/dogo.json", "Usage: dogo -c=/path/to/dogo.json")
	flag.Parse()

	var dogo Dogo

	gopath := console.Getenv("GOPATH")
	c = strings.Replace(c, "{GOPATH}", gopath, -1)

	r := map[string]string{"{GOPATH}": gopath}
	err := config.NewConfig(c).Replace(r).Parse(&dogo)
	if err != nil {
		fmt.Printf("[dogo] Warning: no configuration file loaded.\n")
	} else {
		fmt.Printf("[dogo] Loaded configuration file:\n")
		fmt.Printf("       %s\n", c)
	}

	dogo.NewMonitor()

	l := len(dogo.Files)
	if l > 0 {
		fmt.Printf("[dogo] Ready. %d files to be monitored.\n\n", l)
		dogo.BuildAndRun()
		dogo.Monitor()
	} else {
		fmt.Printf("[dogo] Error: Did not find any files. Press any key to exit.\n\n")
		var a string
		fmt.Scanf("%s", &a)
	}
}
Esempio n. 2
0
File: init.go Progetto: zhgo/solr
func init() {
	var c conf

	// Load config file
	replaces := map[string]string{"{WorkingDir}": config.WorkingDir()}
	config.NewConfig("zhgo.json").Replace(replaces).Parse(c)

	pool = c.Solr
}
Esempio n. 3
0
func main() {
	log.SetFlags(log.Lshortfile)
	db.Env = 3

	var mtq Mtq

	config.NewConfig("migration-to-qiniu.json").Parse(&mtq)

	mtq.Start()
}
Esempio n. 4
0
File: main.go Progetto: liudng/app
func main() {
	// New http application
	app := biz.HttpApp{}

	// Load config file
	replaces := map[string]string{"{WorkingDir}": config.WorkingDir()}
	config.NewConfig("soe-http.json").Replace(replaces).Parse(&app)

	// Start http server.
	app.Load()
	app.LoadMuxList()
	app.Start()

	// Start tcp server.
	// TODO

	// Start jobs.
	// TODO
}