100 lines
3.4 KiB
Go
100 lines
3.4 KiB
Go
package config
|
||
|
||
import "time"
|
||
|
||
type (
|
||
Config struct {
|
||
Env string `yaml:"env" env-default:"production"`
|
||
Host string `yaml:"host" env-default:"localhost"`
|
||
Port int `yaml:"port" env-default:"8000"`
|
||
Keycloak Keycloak
|
||
Broker Broker `yaml:"broker"`
|
||
Secret SecretConfig
|
||
EmailVerificationService EmailVerificationService `yaml:"emailVerificationService"`
|
||
ValkeyCache ValkeyCacheConfig `yaml:"cache"`
|
||
S3Storage S3StorageConfig `yaml:"s3Storage"`
|
||
Database Database `yaml:"database"`
|
||
Integration Integration
|
||
Build BuildInfo
|
||
}
|
||
|
||
BuildInfo struct {
|
||
Version string
|
||
Commit string
|
||
Date string
|
||
}
|
||
|
||
ValkeyCacheConfig struct {
|
||
Addrs string `yaml:"-" env:"CACHE_ADDRS" env-default:"localhost:6379"`
|
||
Password string `yaml:"-" env:"CACHE_PASSWORD" env-default:""`
|
||
ReadOnly bool `yaml:"readOnly" env-default:"false"`
|
||
DialTimeout time.Duration `yaml:"dialTimeout" env-default:"5s"`
|
||
PoolSize int `yaml:"poolSize" env-default:"10"`
|
||
DefaultTTL time.Duration `yaml:"defaultTtl" env-default:"1h"`
|
||
RootCaFilePath string `yaml:"rootCaFilePath" env-default:""`
|
||
}
|
||
|
||
S3StorageConfig struct {
|
||
Bucket string `yaml:"bucket" env-default:""`
|
||
DefaultLinkTTL time.Duration `yaml:"defaultLinkTtl" env-default:"1h"`
|
||
}
|
||
|
||
SecretConfig struct {
|
||
Key string `env:"SHORTENER_SECRET_KEY"` // 32-byte key
|
||
}
|
||
|
||
Keycloak struct {
|
||
BaseURL string `env:"KEYCLOAK_BASE_URL" env-default:"http://localhost"`
|
||
Realm string `env:"KEYCLOAK_REALM" env-default:""`
|
||
ClientId string `env:"KEYCLOAK_CLIENT_ID" env-default:""`
|
||
ClientSecret string `env:"KEYCLOAK_CLIENT_SECRET" env-default:""`
|
||
}
|
||
|
||
Broker struct {
|
||
Host string `yaml:"-" env:"BROKER_HOST" env-default:"amqp://user:password@localhost"`
|
||
Port int `yaml:"-" env:"BROKER_PORT" env-default:"5672"`
|
||
UserName string `yaml:"-" env:"BROKER_USERNAME" env-default:"user"`
|
||
Password string `yaml:"-" env:"BROKER_PASSWORD" env-default:"password"`
|
||
NotificationsQueueName string `yaml:"notificationsQueueName" env-default:"notifications"`
|
||
}
|
||
|
||
// TODO: че с этим делать? Его нигде нет (ни на дев, ни на прод)
|
||
EmailVerificationService struct {
|
||
APIKey string `yaml:"-" env-default:""`
|
||
}
|
||
|
||
Database struct {
|
||
Host string `yaml:"-" env:"DB_HOSTS"`
|
||
Port uint16 `yaml:"-" env:"DB_PORT"`
|
||
Username string `yaml:"-" env:"DB_USERNAME"`
|
||
Password string `yaml:"-" env:"DB_PASSWORD"`
|
||
DBName string `yaml:"-" env:"DB_DBNAME"`
|
||
Schema string `yaml:"schema"`
|
||
SSLMode string `yaml:"sslmode" env-default:"verify-full"`
|
||
RootCaFilePath string `yaml:"rootCaFilePath" env-default:"/root/YandexInternalRootCA.crt"`
|
||
}
|
||
|
||
Integration struct {
|
||
Vkusvill VkusvillIntegration `yaml:"vkusvill"`
|
||
}
|
||
|
||
VkusvillIntegration struct {
|
||
ApiToken string `yaml:"-" env:"INTEGRATION_VKUSVILL_API_TOKEN"`
|
||
}
|
||
)
|
||
|
||
type (
|
||
LocalDeploy struct {
|
||
Deploy LocalDeployConfig `yaml:"deploy"`
|
||
}
|
||
|
||
LocalDeployConfig struct {
|
||
Env []LocalDeployConfigElement `yaml:"env"`
|
||
}
|
||
|
||
LocalDeployConfigElement struct {
|
||
Name string `yaml:"name"`
|
||
Value string `yaml:"value"`
|
||
}
|
||
)
|