Exemple #1
0
// 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)
}
Exemple #2
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)
}