@@ -23,26 +23,26 @@ type S3Config struct {
2323 PathPrefix string `yaml:"path_prefix"`
2424 AccessKeyIDPath string `yaml:"access_key_id_path"`
2525 SecretAccessKeyPath string `yaml:"secret_access_key_path"`
26- S3ForcePathStyle bool `yaml:"s3_force_path_style"`
26+ S3ForcePathStyle bool `yaml:"s3_force_path_style" default:"false" `
2727 IsMock bool
2828}
2929
3030type YDBConnectionConfig struct {
3131 ConnectionString string `yaml:"connection_string"`
32- Insecure bool `yaml:"insecure"`
32+ Insecure bool `yaml:"insecure" default:"false" `
3333 Discovery bool `yaml:"discovery" default:"true"`
3434 DialTimeoutSeconds uint32 `yaml:"dial_timeout_seconds" default:"5"`
3535 OAuth2KeyFile string `yaml:"oauth2_key_file"`
36- EnableSDKMetrics bool `yaml:"enable_sdk_metrics"`
36+ EnableSDKMetrics bool `yaml:"enable_sdk_metrics" default:"true" `
3737}
3838
3939type ClientConnectionConfig struct {
40- Insecure bool `yaml:"insecure"`
40+ Insecure bool `yaml:"insecure" default:"false" `
4141 Discovery bool `yaml:"discovery" default:"true"`
4242 DialTimeoutSeconds uint32 `yaml:"dial_timeout_seconds" default:"5"`
4343 OAuth2KeyFile string `yaml:"oauth2_key_file"`
4444 AllowedEndpointDomains []string `yaml:"allowed_endpoint_domains"`
45- AllowInsecureEndpoint bool `yaml:"allow_insecure_endpoint"`
45+ AllowInsecureEndpoint bool `yaml:"allow_insecure_endpoint" default:"false" `
4646}
4747
4848type AuthConfig struct {
@@ -55,7 +55,7 @@ type GRPCServerConfig struct {
5555 BindPort uint16 `yaml:"bind_port" default:"2135"`
5656 TLSCertificatePath string `yaml:"tls_certificate_path"`
5757 TLSKeyPath string `yaml:"tls_key_path"`
58- LogLevel string `yaml:"log_level"`
58+ LogLevel string `yaml:"log_level" default:"DEBUG" `
5959}
6060
6161type MetricsServerConfig struct {
@@ -65,23 +65,109 @@ type MetricsServerConfig struct {
6565 TLSKeyPath string `yaml:"tls_key_path"`
6666}
6767
68+ type FeatureFlagsConfig struct {
69+ DisableTTLDeletion bool `yaml:"disable_ttl_deletion" default:"false"`
70+ }
71+
72+ type LogConfig struct {
73+ DuplicateToFile string `yaml:"duplicate_to_file"`
74+ Level string `yaml:"level" default:"DEBUG"`
75+ }
76+
77+ type OperationProcessorConfig struct {
78+ OperationTtlSeconds int64 `yaml:"operation_ttl_seconds" default:"86400"`
79+ ProcessorIntervalSeconds int64 `yaml:"processor_interval_seconds" default:"10"`
80+ }
81+
82+ type AuditConfig struct {
83+ EventsDestination string `yaml:"events_destination"`
84+ }
85+
86+ type QuotaConfig struct {
87+ SchedulesPerDB int `yaml:"schedules_per_db" default:"10"`
88+ }
89+
6890type Validatable interface {
6991 Validate () error
7092}
7193
7294type Config struct {
73- DBConnection YDBConnectionConfig `yaml:"db_connection"`
74- ClientConnection ClientConnectionConfig `yaml:"client_connection"`
75- S3 S3Config `yaml:"s3"`
76- OperationTtlSeconds int64 `yaml:"operation_ttl_seconds"`
77- Auth AuthConfig `yaml:"auth"`
78- GRPCServer GRPCServerConfig `yaml:"grpc_server"`
79- MetricsServer MetricsServerConfig `yaml:"metrics_server"`
80- SchedulesLimitPerDB int `yaml:"schedules_limit_per_db" default:"10"`
81- ProcessorIntervalSeconds int64 `yaml:"processor_interval_seconds" default:"10"`
82- DisableTTLDeletion bool `yaml:"disable_ttl_deletion" default:"false"`
83- AuditEventsDestination string `yaml:"audit_events_destination"`
84- DuplicateLogToFile string `yaml:"duplicate_log_to_file"`
95+ DBConnection YDBConnectionConfig `yaml:"db_connection"`
96+ ClientConnection ClientConnectionConfig `yaml:"client_connection"`
97+ S3 S3Config `yaml:"s3"`
98+ Auth AuthConfig `yaml:"auth"`
99+ GRPCServer GRPCServerConfig `yaml:"grpc_server"`
100+ MetricsServer MetricsServerConfig `yaml:"metrics_server"`
101+ OperationProcessor OperationProcessorConfig `yaml:"operation_processor"`
102+ Audit AuditConfig `yaml:"audit"`
103+ Log LogConfig `yaml:"log"`
104+ Quota QuotaConfig `yaml:"quota"`
105+ FeatureFlags FeatureFlagsConfig `yaml:"feature_flags"`
106+
107+ // TODO: remove these fields and their getters after migration to the new config format
108+ OperationTtlSeconds int64 `yaml:"operation_ttl_seconds" default:"86400"`
109+ SchedulesLimitPerDB int `yaml:"schedules_limit_per_db" default:"10"`
110+ ProcessorIntervalSeconds int64 `yaml:"processor_interval_seconds" default:"10"`
111+ DisableTTLDeletion bool `yaml:"disable_ttl_deletion" default:"false"`
112+ AuditEventsDestination string `yaml:"audit_events_destination"`
113+ DuplicateLogToFile string `yaml:"duplicate_log_to_file"`
114+ }
115+
116+ func (c Config ) GetOperationTtlSeconds () int64 {
117+ if c .OperationTtlSeconds == 0 {
118+ return c .OperationProcessor .OperationTtlSeconds
119+ }
120+
121+ return c .OperationTtlSeconds
122+ }
123+
124+ func (c * Config ) SetOperationTtlSeconds (val int64 ) {
125+ c .OperationTtlSeconds = val
126+ c .OperationProcessor .OperationTtlSeconds = val
127+ }
128+
129+ func (c Config ) GetSchedulesLimitPerDB () int {
130+ if c .SchedulesLimitPerDB == 0 {
131+ return c .Quota .SchedulesPerDB
132+ }
133+
134+ return c .SchedulesLimitPerDB
135+ }
136+
137+ func (c Config ) GetProcessorIntervalSeconds () int64 {
138+ if c .ProcessorIntervalSeconds == 0 {
139+ return c .OperationProcessor .ProcessorIntervalSeconds
140+ }
141+
142+ return c .ProcessorIntervalSeconds
143+ }
144+
145+ func (c Config ) GetDisableTTLDeletion () bool {
146+ return c .DisableTTLDeletion || c .FeatureFlags .DisableTTLDeletion
147+ }
148+
149+ func (c Config ) GetAuditEventsDestination () string {
150+ if len (c .AuditEventsDestination ) == 0 {
151+ return c .Audit .EventsDestination
152+ }
153+
154+ return c .AuditEventsDestination
155+ }
156+
157+ func (c Config ) GetDuplicateLogToFile () string {
158+ if len (c .DuplicateLogToFile ) == 0 {
159+ return c .Log .DuplicateToFile
160+ }
161+
162+ return c .DuplicateLogToFile
163+ }
164+
165+ func (c Config ) GetLogLevel () string {
166+ if len (c .GRPCServer .LogLevel ) == 0 {
167+ return c .Log .Level
168+ }
169+
170+ return c .GRPCServer .LogLevel
85171}
86172
87173type ClusterConnectionConfig struct {
0 commit comments