Class: FeatureHub::Sdk::LocalYamlStore
- Inherits:
-
RawUpdateFeatureListener
- Object
- RawUpdateFeatureListener
- FeatureHub::Sdk::LocalYamlStore
- Defined in:
- lib/feature_hub/sdk/local_yaml_store.rb,
sig/feature_hub/featurehub.rbs
Overview
Reads feature flags from a local YAML file and loads them into a FeatureHubRepository, allowing the SDK to operate without a FeatureHub Edge server. Implements RawUpdateFeatureListener but silently ignores all incoming update callbacks — the file is the single source of truth and is read exactly once at initialization.
Expected YAML format (same as LocalYamlValueInterceptor):
flagValues:
MY_FLAG: true
MY_STRING: "hello"
MY_NUMBER: 42
Constant Summary collapse
- SOURCE =
"local-yaml"
Instance Method Summary collapse
-
#initialize(repository, filename = nil) ⇒ LocalYamlStore
constructor
A new instance of LocalYamlStore.
Methods inherited from RawUpdateFeatureListener
#close, #config_changed, #delete_feature, #process_update, #process_updates
Constructor Details
#initialize(repository, filename = nil) ⇒ LocalYamlStore
Returns a new instance of LocalYamlStore.
22 23 24 25 26 27 28 |
# File 'lib/feature_hub/sdk/local_yaml_store.rb', line 22 def initialize(repository, filename = nil) super() @environment_id = SecureRandom.uuid yaml_file = filename || ENV.fetch("FEATUREHUB_LOCAL_YAML", "featurehub-features.yaml") features = load_features(yaml_file) repository.notify("features", features, SOURCE) if features end |