120 lines
3.6 KiB
Go
120 lines
3.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"`
|
|
}
|
|
|
|
type PermissionConf struct {
|
|
// SeedAdminRegister controls the closed-beta admin-only register permission.
|
|
// Turn this off when public registration policy is redesigned.
|
|
SeedAdminRegister bool `json:",default=true"`
|
|
}
|
|
|
|
// 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 S3Conf struct {
|
|
Endpoint string `json:",optional"`
|
|
PublicBaseURL string `json:",optional"`
|
|
Region string `json:",default=us-east-1"`
|
|
Bucket string `json:",optional"`
|
|
AccessKey string `json:",optional"`
|
|
SecretKey string `json:",optional"`
|
|
UsePathStyle bool `json:",default=true"`
|
|
}
|
|
|
|
type StorageConf struct {
|
|
S3 S3Conf `json:",optional"`
|
|
}
|
|
|
|
type SMTPConf struct {
|
|
Host string `json:",optional"`
|
|
Port int `json:",default=25"`
|
|
Username string `json:",optional"`
|
|
Password string `json:",optional"`
|
|
From 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"`
|
|
Storage StorageConf `json:",optional"`
|
|
SMTP SMTPConf `json:",optional"`
|
|
Permission PermissionConf `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"`
|
|
}
|