Example #1
0
func main() {
	flag.StringVar(&config_path, "c", "", "proxy config file")
	flag.Usage = func() {
		fmt.Fprintf(os.Stderr, "Usage: %s -c <config_file>\n", os.Args[0])
		os.Exit(-1)
	}

	flag.Parse()
	if flag.NArg() < 1 && (config_path == "") {
		flag.Usage()
	}

	conf := load_config(config_path)

	log = make(l4g.Logger)
	log_init(log, conf)
	defer log_fini(log)

	proxy.StartProxyServer(conf, log)
}
Example #2
0
func main() {
	var config_path, password string

	flag.StringVar(&config_path, "c", "", "proxy config file")
	flag.StringVar(&password, "p", "", "admin password to connect mongo")
	flag.Usage = func() {
		fmt.Fprintf(os.Stderr, "Usage: %s -c <config_file> -p <admin password>\n", os.Args[0])
		os.Exit(-1)
	}

	flag.Parse()
	if flag.NArg() < 2 && (config_path == "" || password == "") {
		flag.Usage()
	}

	conf := load_config(config_path)
	conf.MONGODB.PASS = password

	log = make(l4g.Logger)
	log_init(log, conf)
	defer log_fini(log)

	proxy.StartProxyServer(conf, log)
}