Skip to content

Commit f508b73

Browse files
committed
configure ENV var OPTIMIZELY_CMAB_PREDICTIONENDPOINT to allow fsc tests to run
1 parent 7f34019 commit f508b73

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

pkg/optimizely/cache.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"context"
2222
"encoding/json"
2323
"errors"
24+
"os"
2425
"regexp"
2526
"strings"
2627
"sync"
@@ -314,6 +315,14 @@ func defaultLoader(
314315
)
315316
clientOptions = append(clientOptions, client.WithOdpManager(odpManager))
316317

318+
// Configure CMAB prediction endpoint from environment variable
319+
// This allows FSC tests to override the endpoint by setting OPTIMIZELY_CMAB_PREDICTIONENDPOINT
320+
if cmabEndpoint := os.Getenv("OPTIMIZELY_CMAB_PREDICTIONENDPOINT"); cmabEndpoint != "" {
321+
// Set the global variable that go-sdk uses (same pattern as go-sdk FSC tests)
322+
cmab.CMABPredictionEndpoint = cmabEndpoint + "/%s"
323+
log.Info().Str("endpoint", cmabEndpoint).Msg("Using custom CMAB prediction endpoint")
324+
}
325+
317326
// Parse CMAB cache configuration
318327
cacheSize := cmab.DefaultCacheSize
319328
cacheTTL := cmab.DefaultCacheTTL

0 commit comments

Comments
 (0)