Exemplo n.º 1
0
func main() {
	// Load default config
	config.LoadDefaults()
	//Parse the command line parameters
	config.ParseCmdParams(config.DefaultCmdLine{
		HostName:         "localhost",
		NodeId:           "fe1",
		Port:             "8081",
		UseSSL:           false,
		RegistryLocation: "http://localhost:2379",
	})
	// Fetch Configuration from etcd
	config.InitEtcd()
	config.FetchCommonConfig()
	config.FetchServiceSection(config.FrontendService)
	config.FetchServiceSection(config.AuthService)
	// Load plugin ini
	fserv.LoadPluginData(config.Frontend.PluginDir + "/plugins.ini")
	database.InitDb()
	// Set up the core logger
	log.SetOutput(&lumberjack.Logger{
		Filename:   config.Logger.LogFile,
		MaxSize:    config.Logger.MaxSize,
		MaxBackups: config.Logger.MaxBackups,
		MaxAge:     config.Logger.MaxAge,
	})
	registry.Init("Frontend", registry.FrontEndLocation)
	routing.Start()
}
Exemplo n.º 2
0
func TestConfigLoader(t *testing.T) {
	setupTest()
	defer cleanup()
	//Set some config items
	config.Notifications.FromEmail = "*****@*****.**"
	//Put them in Etcd
	config_loader.SetConfig()
	//Reset the local config to defaults
	config.LoadDefaults()
	//Check the config items we set
	if config.Notifications.FromEmail != "*****@*****.**" {
		t.Errorf("Notifications.FromEmail not set: %v", config.Notifications.FromEmail)
	}
}
Exemplo n.º 3
0
func setup(t *testing.T) {
	config.LoadDefaults()
	config.Service.RegistryLocation = "http://localhost:2379"
	config.ServiceRegistry.CacheRefreshInterval = 1000
	database.InitDb()
	database.SetupDb()
	//This will cause the registry manager to complain, but we don't
	//really need the service being registered here.
	registry.Init("TestAuth", "/database/test/auth")
	//We need to create a user in order to have any sessions, so
	registration := user_service.Registration{
		NewUser: user,
	}
	_, err := um.SetUp(&registration)
	if err != nil {
		t.Error(err)
	}
}
Exemplo n.º 4
0
func main() {
	// Load the default config
	config.LoadDefaults()
	//Parse the command line parameters
	config.ParseCmdParams(config.DefaultCmdLine{
		HostName:         "localhost",
		NodeId:           "ns1",
		Port:             "4120",
		UseSSL:           false,
		RegistryLocation: "http://localhost:2379",
	})
	// Fetch Configuration from etcd
	config.InitEtcd()
	config.FetchCommonConfig()
	config.FetchServiceSection(config.NotificationService)
	// Set up Logger
	log.SetOutput(&lumberjack.Logger{
		Filename:   config.Logger.LogFile,
		MaxSize:    config.Logger.MaxSize,
		MaxBackups: config.Logger.MaxBackups,
		MaxAge:     config.Logger.MaxAge,
	})
	wsContainer := restful.NewContainer()
	wsContainer.Router(restful.CurlyRouter{})
	//Enable Gzip
	wsContainer.EnableContentEncoding(true)
	//Register the notifications controller
	nc := notification_service.NotificationsController{}
	nc.Register(wsContainer)
	database.InitDb()
	//Register with the service registry
	registry.Init("Notifications", registry.NotificationsLocation)
	httpAddr := ":" + config.Service.Port
	if config.Service.UseSSL == true {
		certFile := config.Service.SSLCertFile
		keyFile := config.Service.SSLKeyFile
		log.Fatal(http.ListenAndServeTLS(httpAddr,
			certFile, keyFile, wsContainer))
	} else {
		log.Fatal(http.ListenAndServe(httpAddr, wsContainer))
	}
}
Exemplo n.º 5
0
func setup() {
	config.LoadDefaults()
	InitDb()
}
Exemplo n.º 6
0
func setup() {
	config.LoadDefaults()
	services.InitDb()
}
Exemplo n.º 7
0
func setupTest() {
	config.LoadDefaults()
	config_loader.InitRegistry()
}
Exemplo n.º 8
0
func setup() {
	config.LoadDefaults()
	database.InitDb()
	database.SetupDb()
}
Exemplo n.º 9
0
func setup() {
	config.LoadDefaults()
	config.Notifications.TemplateDir = "test_templates"
}
Exemplo n.º 10
0
func setup(mainDb string) {
	config.LoadDefaults()
	config.Database.MainDb = mainDb
	InitDb()
	SetupDb()
}