2025-09-30 16:53:31 +00:00
|
|
|
package config
|
|
|
|
|
2025-10-02 06:43:57 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/stores/cache"
|
|
|
|
"github.com/zeromicro/go-zero/core/stores/redis"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
|
|
)
|
2025-09-30 16:53:31 +00:00
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
rest.RestConf
|
2025-10-02 06:43:57 +00:00
|
|
|
// Redis 配置
|
|
|
|
RedisConf redis.RedisConf
|
|
|
|
// Redis Cluster (Cache)
|
|
|
|
Cache cache.CacheConf
|
|
|
|
CacheExpireTime time.Duration
|
|
|
|
CacheWithNotFoundExpiry time.Duration
|
|
|
|
|
|
|
|
Mongo struct {
|
|
|
|
Schema string
|
|
|
|
User string
|
|
|
|
Password string
|
|
|
|
Host string
|
|
|
|
Port string
|
|
|
|
Database string
|
|
|
|
ReplicaName string
|
|
|
|
MaxStaleness time.Duration
|
|
|
|
MaxPoolSize uint64
|
|
|
|
MinPoolSize uint64
|
|
|
|
MaxConnIdleTime time.Duration
|
|
|
|
Compressors []string
|
|
|
|
EnableStandardReadWriteSplitMode bool
|
|
|
|
ConnectTimeoutMs int64
|
|
|
|
}
|
|
|
|
|
|
|
|
// 密碼加密層數
|
|
|
|
Bcrypt struct {
|
|
|
|
Cost int
|
|
|
|
}
|
|
|
|
|
|
|
|
GoogleAuth struct {
|
|
|
|
ClientID string
|
|
|
|
AuthURL string
|
|
|
|
}
|
|
|
|
|
|
|
|
LineAuth struct {
|
|
|
|
ClientID string
|
|
|
|
ClientSecret string
|
|
|
|
RedirectURI string
|
|
|
|
}
|
2025-10-06 08:28:39 +00:00
|
|
|
|
|
|
|
// JWT Token 配置
|
|
|
|
Token struct {
|
|
|
|
AccessSecret string
|
|
|
|
RefreshSecret string
|
|
|
|
AccessTokenExpiry time.Duration
|
|
|
|
RefreshTokenExpiry time.Duration
|
|
|
|
OneTimeTokenExpiry time.Duration
|
|
|
|
MaxTokensPerUser int
|
|
|
|
MaxTokensPerDevice int
|
|
|
|
}
|
2025-09-30 16:53:31 +00:00
|
|
|
}
|