go-sample-webpage/main.go
kekskurse 82441fc9d6
Some checks failed
continuous-integration/drone/push Build is failing
User
2021-11-23 20:21:43 +01:00

41 lines
1 KiB
Go

package main
import (
"crypto/tls"
"embed"
"git.keks.cloud/kekskurse/go-sample-webpage/pkg/sample"
"git.keks.cloud/kekskurse/go-sample-webpage/pkg/user"
"git.keks.cloud/kekskurse/go-sample-webpage/pkg/webpage"
"github.com/go-chi/chi/v5"
"github.com/go-chi/jwtauth/v5"
gomail "gopkg.in/mail.v2"
)
// content holds our static web server content.
//go:embed static/* templates/*
var webserver embed.FS
//go:embed database/migrations/*.sql
var migrationFS embed.FS
func main() {
config := webpage.WebPageConfig{
Templates: webserver,
Static: webserver,
Migrations: migrationFS,
Bootstrap: func(router chi.Router) {
tokenAuth := jwtauth.New("HS256", []byte("secret"), nil)
uc := user.GetUserMemmoryClient()
d := gomail.NewDialer("localhost", 1025, "from@gmail.com", "email_password")
d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
userconfig := user.NewUserConfig()
sample.Register(router)
user.Register(router, tokenAuth, uc, d, userconfig)
},
}
webpage.RunWebApp(config)
}