@@ -20,17 +20,20 @@ type ProviderConfig struct {
2020 ClientSecret string
2121
2222 // Optional: Custom service addresses (for advanced use cases only)
23- // If not provided, defaults to EU region
23+ // If not provided, defaults to global region
2424 ResolverStateServiceAddr string
2525 FlagLoggerServiceAddr string
2626 AuthServiceAddr string
27-
28- // Optional: Custom WASM bytes (for advanced use cases only)
29- // If not provided, loads from default location
30- WasmBytes []byte
3127}
3228
3329// ProviderConfigWithStateProvider holds configuration for the Confidence provider with a custom StateProvider
30+ // WARNING: This configuration is intended for testing and advanced use cases ONLY.
31+ // For production deployments, use NewProvider() with ProviderConfig instead, which provides:
32+ // - Automatic state fetching from Confidence backend
33+ // - Built-in authentication and secure connections
34+ // - Exposure event logging for analytics
35+ //
36+ // Only use this when you need to provide a custom state source (e.g., local file cache for testing).
3437type ProviderConfigWithStateProvider struct {
3538 // Required: Client secret for signing evaluations
3639 ClientSecret string
@@ -75,15 +78,10 @@ func NewProvider(ctx context.Context, config ProviderConfig) (*LocalResolverProv
7578 authServiceAddr = ConfidenceDomain
7679 }
7780
78- // Load WASM bytes
79- wasmBytes := config .WasmBytes
80- if wasmBytes == nil {
81- // Load from default filesystem location
82- var err error
83- wasmBytes , err = os .ReadFile ("../../../wasm/confidence_resolver.wasm" )
84- if err != nil {
85- return nil , fmt .Errorf ("failed to load WASM module from ../../wasm/confidence_resolver.wasm: %w. Please provide WasmBytes in config or ensure WASM file exists" , err )
86- }
81+ // Load wasm from default filesystem location
82+ wasmBytes , err := os .ReadFile ("../../../wasm/confidence_resolver.wasm" )
83+ if err != nil {
84+ return nil , fmt .Errorf ("failed to load WASM module from ../../../wasm/confidence_resolver.wasm: %w" , err )
8785 }
8886
8987 runtimeConfig := wazero .NewRuntimeConfig ()
@@ -114,6 +112,7 @@ func NewProvider(ctx context.Context, config ProviderConfig) (*LocalResolverProv
114112}
115113
116114// NewProviderWithStateProvider creates a new Confidence OpenFeature provider with a custom StateProvider
115+ // Should only be used for testing purposes. Will not emit exposure logging.
117116func NewProviderWithStateProvider (ctx context.Context , config ProviderConfigWithStateProvider ) (* LocalResolverProvider , error ) {
118117 // Validate required fields
119118 if config .ClientSecret == "" {
0 commit comments