go-sample-webpage/main.go
kekskurse 16292a3b74
Some checks failed
continuous-integration/drone/push Build is failing
Register Stuff
2021-11-22 23:46:01 +01:00

39 lines
977 B
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}
sample.Register(router)
user.Register(router, tokenAuth, uc, d)
},
}
webpage.RunWebApp(config)
}