Creates an object that allows you to use local files as a source of feature flag state, instead of connecting to LaunchDarkly. This would typically be used in a test environment.
For more information about this feature, see the SDK features guide.
To use this component, call FileDataSource(options)
and store the result in the updateProcessor
property of your LaunchDarkly client configuration:
const { FileDataSource } = require('launchdarkly-node-server-sdk/integrations');
const dataSource = FileDataSource({ paths: [ myFilePath ] });
const config = { updateProcessor: dataSource };
This will cause the client not to connect to LaunchDarkly to get feature flags, and use the file data instead.
The client may still make network connections to send analytics events, unless you have
disabled this in your configuration by setting LDOptions.sendEvents to false
.
The supported file formats are as follows:
yaml
package in your application. This
package is not installed by default, to avoid adding to the size of the SDK bundle
for this rarely-used feature. The SDK is compatible with any version of the package
that supports calling yaml.parse(string)
with no custom options. Configuration for the data source. You should at least set the paths
property.
An object to put in the updateProcessor
property for LDOptions.
A mechanism for providing dynamically updatable feature flag state in a simplified form to an SDK client in test scenarios.
Generated using TypeDoc
This module contains tools for connecting the LaunchDarkly client to other software, or to test fixtures.