fix config

This commit is contained in:
Daniel 2024-08-04 09:07:31 -04:00
parent 8742029109
commit 59fb6e047d
3 changed files with 7 additions and 8 deletions

View file

@ -27,16 +27,15 @@ type Authenticator interface {
}
type authenticator struct {
domain string
jwt *jwtauth.JWTAuth
cfg *config.Auth
cfg config.Auth
}
// NewAuthenticator creates a new Authenticator with the provided config.
func NewAuthenticator(cfg *config.Auth) Authenticator {
func NewAuthenticator(cfg config.Auth) Authenticator {
return &authenticator{
domain: cfg.Domain,
jwt: jwtauth.New("HS256", []byte(cfg.JWTSecret), nil),
cfg: cfg,
}
}

View file

@ -120,7 +120,7 @@ func (a *authenticator) routeAuth(w http.ResponseWriter, r *http.Request) {
Value: tok,
HttpOnly: true,
Secure: a.allowInsecureCookie(r),
Domain: a.domain,
Domain: a.cfg.Domain,
})
jr := struct {

View file

@ -30,7 +30,7 @@ func New(cfg *config.Config) (*Server, error) {
}
r := chi.NewRouter()
authenticator := auth.NewAuthenticator(&cfg.Auth)
authenticator := auth.NewAuthenticator(cfg.Auth)
srv := &Server{
auth: authenticator,
conf: cfg,