Пример #1
0
func main() {
	// Step1. Get Config Path
	defaultConfigPath := utils.GetPath([]string{"assets", "config.json"})
	configPath := flag.String("c", defaultConfigPath, "use '-c' option to specify the config file path")

	// Step2. Load configuration
	_, err := conf.LoadConfig(*configPath)
	if err != nil {
		panic("Error loading config file...")
	}

	// Step3. Start Server
	server := webs.CreateServer()
	server.Start()
}
Пример #2
0
func main() {
	err := checkCloudName(options.Cloud)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}

	_, err = conf.LoadConfig(options.ConfigPath)
	if err != nil {
		panic(fmt.Sprintf("Error loading config file [%s]...", err.Error()))
	}

	server, err := webs.CreateServer(options.Cloud)
	if err != nil {
		panic(fmt.Sprintf("Error creating server [%s]...", err.Error))
	}

	server.Start()
}