Example #1
0
func main() {
	if len(os.Args) != 2 && len(os.Args) != 1 {
		fmt.Println("Invalid command usage\n")
		showUsage()
		os.Exit(1)
	}
	arg := "start"
	if len(os.Args) == 2 {
		arg = os.Args[1]
	}
	config.Loads("config/config.yml")
	switch arg {
	case "start":
		config.SetEnv(config.EnvDevelopment)
	case "deploy":
		config.SetEnv(config.EnvProduction)
	case "test":
		config.SetEnv(config.EnvTesting)
	default:
		fmt.Println("Invalid command:", arg)
		showUsage()
		os.Exit(1)
	}
	cmd.Server()
}
Example #2
0
File: init.go Project: oblank/forum
func init() {
	config.Loads("../config/config.yml")
	config.SetEnv(config.EnvTesting)
	env := config.GetEnvValue()
	server = getConnectString(env.Server.Host, env.Server.Port)
	userApi = server + "/v1/user/"
	authApi = server + "/v1/auth/"
	errorApi = server + "/v1/errors/"
	database.InitDb()
}