Beispiel #1
0
func buildApp() kit.App {
	app := NewApp("")

	conf := app.Registry().Config()
	conf.Set("host", "localhost")
	conf.Set("port", 10010)
	conf.Set("url", "http://localhost:10010")

	conf.Set("users.emailConfirmationPath", "?confirm-email={token}")
	conf.Set("users.passwordResetPath", "?reset-password={token}")

	backend := memory.New()
	app.RegisterBackend(backend)

	// Build user service.

	userService := users.NewService(nil, backend, &UserProfile{})
	app.RegisterUserService(userService)

	// Register facebook oauth service.
	appId := "170108689991460"
	appSecret := "cb91c245199a3d3b19fdccbe0c7f93a0"
	fbService := oauth.NewFacebook(appId, appSecret)
	userService.AuthAdaptor("oauth").(*oauth.AuthAdaptorOauth).RegisterService(fbService)

	// Persist log messages in logMessages.
	app.Logger().Hooks.Add(LoggerHook{})

	app.PrepareBackends()

	return app
}
Beispiel #2
0
func (a *App) BuildDefaultUserService(b db.Backend) {
	s := users.NewService(nil, b, nil)
	a.RegisterUserService(s)
}