示例#1
0
文件: main.go 项目: coddo/gost
// Function for performing automatic initializations at application startup
func init() {
	var emptyConfigParam string

	// Initialize application configuration
	config.InitApp(emptyConfigParam)
	config.InitDatabase(emptyConfigParam)
	config.InitRoutes(emptyConfigParam)

	// Initialize the MongoDb service
	service.InitDbService()

	// Register the API endpoints
	// httphandle.RegisterEndpoints(new(ApplicationAPIContainer))   ----- Use this API container when deploying in PRODUCTION
	httphandle.RegisterEndpoints(new(DevAPIContainer)) //----- Use this API container when in development
	devapi.InitDevRoutes()                             //----- Uncomment this line when in development

	// Start the caching system
	cache.StartCachingSystem(cache.DefaultCacheExpireTime)

	// Initialize the cookie store in the auth module
	cookies.InitCookieStore()

	// Initialize the encryption module
	security.InitCipherModule()

	// Set the app to use all the available processors
	runtime.GOMAXPROCS(numberOfProcessors)
}
func setUpTransactionsTest(t *testing.T) {
	testconfig.InitTestsDatabase()
	service.InitDbService()

	if recover() != nil {
		t.Fatal("Test setup failed!")
	}
}
示例#3
0
// InitializeServerConfigurations initializes the HTTP/HTTPS server used for unit testing
func InitializeServerConfigurations(apiInterface interface{}) {
	testconfig.InitTestsApp()

	testconfig.InitTestsDatabase()
	testconfig.InitTestsRoutes()

	service.InitDbService()

	httphandle.RegisterEndpoints(apiInterface)

	runtime.GOMAXPROCS(2)
}