Exemple #1
0
func main() {
	// Load the configuration file
	jsonconfig.Load("config"+string(os.PathSeparator)+"config.json", config)

	// Configure the session cookie store
	session.Configure(config.Session)

	// Connect to database
	database.Connect(config.Database)

	// Setup the views
	view.Configure(config.View)
	view.LoadTemplates(config.Template.Root, config.Template.Children)
	view.LoadPlugins(plugin.TemplateFuncMap(config.View))

	// Start the listener
	server.Run(route.Load(), config.Server)
}
Exemple #2
0
func main() {
	// Load the configuration file
	jsonconfig.Load("config"+string(os.PathSeparator)+"config.json", config.Raw)

	// Start the session
	session.Start(config.Raw.Session.SecretKey, config.Raw.Session.Options,
		config.Raw.Session.Name)

	// Connect to MySQL
	mysql.Config(config.Raw.MySQL)

	// Setup the views
	view.Config(config.Raw.View)
	view.LoadTemplates(config.Raw.Template.Root, config.Raw.Template.Children)
	view.LoadPlugins(plugin.TemplateFuncMap())

	// Start the HTTP listener
	log.Fatal(http.ListenAndServe(config.ListenAddress(), handlers()))
}
Exemple #3
0
func main() {
	// Load the configuration file
	jsonconfig.Load("config"+string(os.PathSeparator)+"config.json", config)

	// Configure the session cookie store
	session.Configure(config.Session)

	// Connect to database
	database.Connect(config.Database)

	// Configure the Google reCAPTCHA prior to loading view plugins
	recaptcha.Configure(config.Recaptcha)

	// Setup the views
	view.Configure(config.View)
	view.LoadTemplates(config.Template.Root, config.Template.Children)
	view.LoadPlugins(
		plugin.TagHelper(config.View),
		plugin.NoEscape(),
		recaptcha.RecaptchaPlugin())

	// Start the listener
	server.Run(route.LoadHTTP(), route.LoadHTTPS(), config.Server)
}