haixunMaster/haixun-backend/internal/config/config.go

49 lines
1.2 KiB
Go
Raw Normal View History

2026-06-23 09:54:27 +00:00
package config
import "github.com/zeromicro/go-zero/rest"
type MongoConf struct {
URI string
Database string
TimeoutSeconds int `json:",default=10"`
}
type RedisConf struct {
Addr string `json:",optional"`
DB int `json:",optional"`
}
type JobWorkerConf struct {
Enabled bool `json:",default=true"`
WorkerType string `json:",default=go"`
WorkerID string `json:",optional"`
}
type JobSchedulerConf struct {
Enabled bool `json:",default=true"`
IntervalSeconds int `json:",default=60"`
}
type JobReaperConf struct {
Enabled bool `json:",default=true"`
IntervalSeconds int `json:",default=30"`
}
type AuthConf struct {
AccessSecret string `json:",optional"`
RefreshSecret string `json:",optional"`
AccessExpireSeconds int64 `json:",default=900"`
RefreshExpireSeconds int64 `json:",default=2592000"`
DevHeaderFallback bool `json:",default=true"`
}
type Config struct {
rest.RestConf
Mongo MongoConf `json:",optional"`
Redis RedisConf `json:",optional"`
Auth AuthConf `json:",optional"`
JobWorker JobWorkerConf `json:",optional"`
JobScheduler JobSchedulerConf `json:",optional"`
JobReaper JobReaperConf `json:",optional"`
}