This commit is contained in:
@@ -31,6 +31,9 @@ const (
|
||||
defaultAuthJWTIssuer = "vctp"
|
||||
defaultAuthJWTAudience = "vctp-api"
|
||||
defaultAuthClockSkewSeconds = 60
|
||||
|
||||
scheduledAggregationEngineGo = "go"
|
||||
scheduledAggregationEngineSQL = "sql"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
@@ -94,6 +97,11 @@ type SettingsYML struct {
|
||||
HourlySnapshotTimeoutSeconds int `yaml:"hourly_snapshot_timeout_seconds"`
|
||||
HourlySnapshotRetrySeconds int `yaml:"hourly_snapshot_retry_seconds"`
|
||||
HourlySnapshotMaxRetries int `yaml:"hourly_snapshot_max_retries"`
|
||||
CaptureWriteBatchSize int `yaml:"capture_write_batch_size"`
|
||||
SnapshotTableCompatMode *bool `yaml:"snapshot_table_compat_mode"`
|
||||
AsyncReportGeneration *bool `yaml:"async_report_generation"`
|
||||
PostgresVmHourlyPartitioning *bool `yaml:"postgres_vm_hourly_partitioning_enabled"`
|
||||
ScheduledAggregationEngine string `yaml:"scheduled_aggregation_engine"`
|
||||
DailyJobTimeoutSeconds int `yaml:"daily_job_timeout_seconds"`
|
||||
MonthlyJobTimeoutSeconds int `yaml:"monthly_job_timeout_seconds"`
|
||||
MonthlyAggregationGranularity string `yaml:"monthly_aggregation_granularity"`
|
||||
@@ -250,6 +258,29 @@ func applyDefaultsAndValidateSettings(cfg *SettingsYML) error {
|
||||
if s.AuthClockSkewSeconds == 0 {
|
||||
s.AuthClockSkewSeconds = defaultAuthClockSkewSeconds
|
||||
}
|
||||
if s.CaptureWriteBatchSize <= 0 {
|
||||
s.CaptureWriteBatchSize = 1000
|
||||
}
|
||||
if s.SnapshotTableCompatMode == nil {
|
||||
v := true
|
||||
s.SnapshotTableCompatMode = &v
|
||||
}
|
||||
if s.AsyncReportGeneration == nil {
|
||||
v := true
|
||||
s.AsyncReportGeneration = &v
|
||||
}
|
||||
if s.PostgresVmHourlyPartitioning == nil {
|
||||
v := false
|
||||
s.PostgresVmHourlyPartitioning = &v
|
||||
}
|
||||
s.ScheduledAggregationEngine = strings.ToLower(strings.TrimSpace(s.ScheduledAggregationEngine))
|
||||
if s.ScheduledAggregationEngine == "" {
|
||||
s.ScheduledAggregationEngine = scheduledAggregationEngineGo
|
||||
}
|
||||
s.MonthlyAggregationGranularity = strings.ToLower(strings.TrimSpace(s.MonthlyAggregationGranularity))
|
||||
if s.MonthlyAggregationGranularity == "" {
|
||||
s.MonthlyAggregationGranularity = "daily"
|
||||
}
|
||||
s.AuthJWTSigningKey = strings.TrimSpace(s.AuthJWTSigningKey)
|
||||
s.LDAPBindAddress = strings.TrimSpace(s.LDAPBindAddress)
|
||||
s.LDAPBaseDN = strings.TrimSpace(s.LDAPBaseDN)
|
||||
@@ -265,6 +296,11 @@ func applyDefaultsAndValidateSettings(cfg *SettingsYML) error {
|
||||
if s.AuthClockSkewSeconds < 0 {
|
||||
return errors.New("settings.auth_clock_skew_seconds must be >= 0")
|
||||
}
|
||||
switch s.ScheduledAggregationEngine {
|
||||
case scheduledAggregationEngineGo, scheduledAggregationEngineSQL:
|
||||
default:
|
||||
return fmt.Errorf("settings.scheduled_aggregation_engine must be %q or %q", scheduledAggregationEngineGo, scheduledAggregationEngineSQL)
|
||||
}
|
||||
|
||||
if len(s.AuthGroupRoleMappings) > 0 {
|
||||
normalized := make(map[string]string, len(s.AuthGroupRoleMappings))
|
||||
|
||||
Reference in New Issue
Block a user