You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

36 lines
662 B

package main
import (
clientv3 "go.etcd.io/etcd/client/v3"
"sonet/internal/auth/data"
"sonet/internal/auth/logic"
"sonet/pkg/config"
"sonet/pkg/utils/shutdown"
)
type AuthConfig struct {
AesTokenKey string
}
func main() {
appConf := &AuthConfig{}
conf := config.LoadConfig(appConf, "cmd/auth")
// registry and run...
etcdClient, err := clientv3.New(conf.Etcd)
if err != nil {
panic(err)
}
// user dao
userDao := data.NewUserDao(config.NewGorm(conf.Gorm))
authServer := logic.NewAuthServer(appConf.AesTokenKey, userDao)
go func() {
err = authServer.Run(conf.Grpc, etcdClient)
if err != nil {
panic(err)
}
}()
shutdown.Await()
}