Files
atomctl/templates/project/providers/jwt/config.go.tpl
2025-01-22 14:50:54 +08:00

36 lines
620 B
Smarty

package jwt
import (
"time"
log "github.com/sirupsen/logrus"
"{{.ModuleName}}/pkg/atom/container"
"{{.ModuleName}}/pkg/atom/opt"
)
const DefaultPrefix = "JWT"
func DefaultProvider() container.ProviderContainer {
return container.ProviderContainer{
Provider: Provide,
Options: []opt.Option{
opt.Prefix(DefaultPrefix),
},
}
}
type Config struct {
SigningKey string // jwt签名
ExpiresTime string //
Issuer string //
}
func (c *Config) ExpiresTimeDuration() time.Duration {
d, err := time.ParseDuration(c.ExpiresTime)
if err != nil {
log.Fatal(err)
}
return d
}