Class: FeatureHub::Sdk::LocalYamlStore

Inherits:
RawUpdateFeatureListener show all
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 =

Returns:

  • (String)
"local-yaml"

Instance Method Summary collapse

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.

Parameters:



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