Class: DataShifter::Configuration
- Inherits:
-
Object
- Object
- DataShifter::Configuration
- Defined in:
- lib/data_shifter/configuration.rb
Overview
Global configuration for DataShifter.
Configure via:
DataShifter.configure do |config|
config.allow_external_requests = ["api.readonly.example.com"]
config.suppress_repeated_logs = true
end
Or access directly:
DataShifter.config.progress_enabled = false
Instance Attribute Summary collapse
-
#allow_external_requests ⇒ Object
Hosts or regexes allowed for HTTP during dry run only (combined with per-shift allow_external_requests).
-
#allow_loopback_requests ⇒ Object
Whether to allow loopback HTTP (127.0.0.1, ::1, localhost) during dry runs.
-
#progress_enabled ⇒ Object
Global default for progress bar visibility.
-
#repeated_log_cap ⇒ Object
Maximum unique log messages to track for deduplication.
-
#status_interval_seconds ⇒ Object
Default status print interval in seconds when ENV STATUS_INTERVAL is not set.
-
#suppress_repeated_logs ⇒ Object
Whether to suppress repeated log messages during a shift run.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
39 40 41 42 43 44 45 46 |
# File 'lib/data_shifter/configuration.rb', line 39 def initialize @allow_external_requests = [] @allow_loopback_requests = true @suppress_repeated_logs = true @repeated_log_cap = 1000 @progress_enabled = true @status_interval_seconds = nil end |
Instance Attribute Details
#allow_external_requests ⇒ Object
Hosts or regexes allowed for HTTP during dry run only (combined with per-shift allow_external_requests). Has no effect in commit mode — HTTP is unrestricted when dry_run is false.
17 18 19 |
# File 'lib/data_shifter/configuration.rb', line 17 def allow_external_requests @allow_external_requests end |
#allow_loopback_requests ⇒ Object
Whether to allow loopback HTTP (127.0.0.1, ::1, localhost) during dry runs. Default: true. Loopback is rarely “external” and is needed for tracing/metrics sidecars (Datadog agent on 8126, statsd on 8125, OTLP collector, etc.). Set to false if you want strict net blocking.
22 23 24 |
# File 'lib/data_shifter/configuration.rb', line 22 def allow_loopback_requests @allow_loopback_requests end |
#progress_enabled ⇒ Object
Global default for progress bar visibility. Default: true. Per-shift ‘progress true/false` overrides this.
34 35 36 |
# File 'lib/data_shifter/configuration.rb', line 34 def progress_enabled @progress_enabled end |
#repeated_log_cap ⇒ Object
Maximum unique log messages to track for deduplication. Default: 1000. When exceeded, entries with count == 1 are cleared first; repeated entries are kept.
30 31 32 |
# File 'lib/data_shifter/configuration.rb', line 30 def repeated_log_cap @repeated_log_cap end |
#status_interval_seconds ⇒ Object
Default status print interval in seconds when ENV STATUS_INTERVAL is not set. Default: nil.
37 38 39 |
# File 'lib/data_shifter/configuration.rb', line 37 def status_interval_seconds @status_interval_seconds end |
#suppress_repeated_logs ⇒ Object
Whether to suppress repeated log messages during a shift run. Default: true. Can be overridden per shift with ‘suppress_repeated_logs true/false`.
26 27 28 |
# File 'lib/data_shifter/configuration.rb', line 26 def suppress_repeated_logs @suppress_repeated_logs end |