2024-02-12 04:52:41 +08:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
2024-02-13 00:02:55 +08:00
|
|
|
Server ServerConfig
|
|
|
|
Log LoggingConfig
|
|
|
|
JWT JWTConfig
|
|
|
|
DB DBConfig
|
|
|
|
TG TGConfig
|
2024-02-12 04:52:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type ServerConfig struct {
|
2024-02-13 00:02:55 +08:00
|
|
|
Port int
|
|
|
|
GracefulShutdown time.Duration
|
2024-02-12 04:52:41 +08:00
|
|
|
}
|
|
|
|
|
2024-02-13 00:02:55 +08:00
|
|
|
type TGConfig struct {
|
|
|
|
AppId int
|
|
|
|
AppHash string
|
|
|
|
RateLimit bool
|
|
|
|
RateBurst int
|
|
|
|
Rate int
|
|
|
|
DeviceModel string
|
|
|
|
SystemVersion string
|
|
|
|
AppVersion string
|
|
|
|
LangCode string
|
|
|
|
SystemLangCode string
|
|
|
|
LangPack string
|
2024-02-13 02:59:06 +08:00
|
|
|
SessionFile string
|
2024-02-13 00:02:55 +08:00
|
|
|
BgBotsLimit int
|
|
|
|
DisableStreamBots bool
|
2024-02-12 04:52:41 +08:00
|
|
|
Uploads struct {
|
2024-02-13 00:02:55 +08:00
|
|
|
EncryptionKey string
|
|
|
|
Threads int
|
|
|
|
Retention time.Duration
|
|
|
|
}
|
2024-02-12 04:52:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type LoggingConfig struct {
|
2024-02-13 00:02:55 +08:00
|
|
|
Level int
|
|
|
|
Development bool
|
2024-02-13 02:22:52 +08:00
|
|
|
File string
|
2024-02-12 04:52:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type JWTConfig struct {
|
2024-02-13 00:02:55 +08:00
|
|
|
Secret string
|
|
|
|
SessionTime time.Duration
|
|
|
|
AllowedUsers []string
|
2024-02-12 04:52:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type DBConfig struct {
|
2024-02-13 00:02:55 +08:00
|
|
|
DataSource string
|
|
|
|
LogLevel int
|
|
|
|
Migrate struct {
|
|
|
|
Enable bool
|
2024-02-12 04:52:41 +08:00
|
|
|
}
|
2024-02-13 00:02:55 +08:00
|
|
|
Pool struct {
|
2024-02-13 02:22:52 +08:00
|
|
|
MaxOpenConnections int
|
|
|
|
MaxIdleConnections int
|
|
|
|
MaxLifetime time.Duration
|
2024-02-12 04:52:41 +08:00
|
|
|
}
|
|
|
|
}
|