thread-master/backend/internal/config/config.go

89 lines
2.6 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 ThreadsOAuthConf struct {
AppID string `json:",optional"`
AppSecret string `json:",optional"`
RedirectURI string `json:",optional"`
SuccessRedirect string `json:",optional"`
}
type ThreadsTokenRefreshConf struct {
Enabled bool `json:",default=true"`
IntervalSeconds int `json:",default=3600"`
LeadDays int `json:",default=7"`
}
type ThreadsPublishQueueConf struct {
Enabled bool `json:",default=true"`
IntervalSeconds int `json:",default=60"`
BatchSize int `json:",default=20"`
}
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"`
ThreadsOAuth ThreadsOAuthConf `json:",optional"`
ThreadsTokenRefresh ThreadsTokenRefreshConf `json:",optional"`
ThreadsPublishQueue ThreadsPublishQueueConf `json:",optional"`
}