67 lines
1.8 KiB
Go
67 lines
1.8 KiB
Go
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"`
|
|
Password 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=false"`
|
|
}
|
|
|
|
type InternalWorkerConf struct {
|
|
Secret string `json:",optional"`
|
|
}
|
|
|
|
// SecretsConf holds the application-layer encryption key (base64 of 32 bytes)
|
|
// used to encrypt sensitive data at rest (browser session, third-party API keys).
|
|
type SecretsConf struct {
|
|
EncryptionKey string `json:",optional"`
|
|
}
|
|
|
|
type BraveConf struct {
|
|
APIKey string `json:",optional"`
|
|
}
|
|
|
|
type Config struct {
|
|
rest.RestConf
|
|
Mongo MongoConf `json:",optional"`
|
|
Redis RedisConf `json:",optional"`
|
|
Auth AuthConf `json:",optional"`
|
|
Secrets SecretsConf `json:",optional"`
|
|
InternalWorker InternalWorkerConf `json:",optional"`
|
|
JobWorker JobWorkerConf `json:",optional"`
|
|
JobScheduler JobSchedulerConf `json:",optional"`
|
|
JobReaper JobReaperConf `json:",optional"`
|
|
Brave BraveConf `json:",optional"`
|
|
}
|