Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/ldclient-rb/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ def offline?
# This payload filter key only applies to the default streaming and polling data sources. It will not affect TestData or FileData
# data sources, nor will it be applied to any data source provided through the {#data_source} config property.
#
# Payload filtering is not supported with the FDv2 data system, so this key has no effect on requests made by FDv2
# data sources.
#
attr_reader :payload_filter_key

#
Expand Down
5 changes: 5 additions & 0 deletions lib/ldclient-rb/impl/data_system/fdv2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ def initialize(sdk_key, config, data_system_config)
@config = config
@data_system_config = data_system_config
@logger = config.logger

unless config.payload_filter_key.nil?
@logger.warn { "[LDClient] Payload filtering is not supported with the FDv2 data system; the configured payload filter has no effect on FDv2 requests" }
end

@synchronizer_builders = data_system_config.synchronizers || []
@fdv1_fallback_synchronizer_builder = data_system_config.fdv1_fallback_synchronizer
@disabled = @config.offline?
Expand Down
23 changes: 23 additions & 0 deletions spec/impl/data_system/fdv2_datasystem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,29 @@ def build(_sdk_key, _config)
fdv2.stop
end
end

describe "payload filter key" do
let(:data_system_config) do
LaunchDarkly::DataSystem::ConfigBuilder.new
.initializers([])
.synchronizers([])
.build
end

it "warns when a payload filter key is configured" do
logger = double.as_null_object
expect(logger).to receive(:warn)

FDv2.new(sdk_key, LaunchDarkly::Config.new(logger: logger, payload_filter_key: "microservice-1"), data_system_config)
end

it "does not warn when no payload filter key is configured" do
logger = double.as_null_object
expect(logger).not_to receive(:warn)

FDv2.new(sdk_key, LaunchDarkly::Config.new(logger: logger), data_system_config)
end
end
end
end
end
Expand Down
Loading