Simplify config and add user white list

This commit is contained in:
2025-08-14 12:25:58 +03:00
parent 137da5a893
commit aae83db2ea
4 changed files with 65 additions and 51 deletions

View File

@@ -10,32 +10,29 @@ import (
type Config struct {
Server ServerConfig `toml:"server"`
Database DatabaseConfig `toml:"database"`
AWS AWSConfig `toml:"aws"`
Yandex YandexConfig `toml:"yandex"`
Telegram TelegramConfig `toml:"telegram"`
}
type ServerConfig struct {
Port int `toml:"port"`
ShutdownTimeout int `toml:"shutdown_timeout"`
ForceShutdownTimeout int `toml:"force_shutdown_timeout"`
Port int `toml:"port"`
ShutdownTimeout int `toml:"shutdown_timeout"`
ForceShutdownTimeout int `toml:"force_shutdown_timeout"`
UsersWhiteList []string `toml:"users_while_list"`
}
type DatabaseConfig struct {
Path string `toml:"path"`
}
type AWSConfig struct {
Region string `toml:"region"`
AccessKey string `toml:"access_key_id"`
SecretKey string `toml:"secret_access_key"`
BucketName string `toml:"bucket_name"`
Endpoint string `toml:"endpoint"`
}
type YandexConfig struct {
APIKey string `toml:"api_key"`
FolderID string `toml:"folder_id"`
FolderID string `toml:"folder_id"`
SpeechKitAPIKey string `toml:"speech_kit_api_key"`
ObjStorageAccessKey string `toml:"object_storage_access_key_id"`
ObjStorageSecretKey string `toml:"object_storage_secret_access_key"`
ObjStorageBucketName string `toml:"object_storage_bucket_name"`
ObjStorageRegion string `toml:"object_storage_region"`
ObjStorageEndpoint string `toml:"object_storage_endpoint"`
}
type TelegramConfig struct {
@@ -54,16 +51,14 @@ func DefaultConfig() *Config {
Database: DatabaseConfig{
Path: "data/transcriber.db",
},
AWS: AWSConfig{
Region: "ru-central1",
AccessKey: "",
SecretKey: "",
BucketName: "",
Endpoint: "",
},
Yandex: YandexConfig{
APIKey: "",
FolderID: "",
FolderID: "",
SpeechKitAPIKey: "",
ObjStorageAccessKey: "",
ObjStorageSecretKey: "",
ObjStorageBucketName: "",
ObjStorageRegion: "ru-central1",
ObjStorageEndpoint: "https://storage.yandexcloud.net/",
},
Telegram: TelegramConfig{
BotToken: "",