Skip to content

Commit e9f9314

Browse files
author
Mike Heffner
authored
Support local LD relay and disable telemetry. (#195)
1 parent c4ba4e2 commit e9f9314

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

featureflag/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@ type Config struct {
1111
RequestTimeout time.Duration `mapstructure:"request_timeout" split_words:"true" default:"5s"`
1212
Enabled bool `default:"false"`
1313
updateProcessorFactory ld.UpdateProcessorFactory
14+
15+
// Drop telemetry events (not needed in local-dev/CI environments)
16+
DisableEvents bool `mapstructure:"disable_events" split_words:"true"`
17+
18+
// Set when using the Launch Darkly Relay proxy
19+
RelayHost string `mapstructure:"relay_host" split_words:"true"`
1420
}

featureflag/featureflag.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ func NewClient(cfg *Config, logger logrus.FieldLogger) (Client, error) {
4141
logger = noopLogger()
4242
}
4343

44+
if cfg.RelayHost != "" {
45+
config.BaseUri = cfg.RelayHost
46+
config.StreamUri = cfg.RelayHost
47+
config.EventsUri = cfg.RelayHost
48+
}
49+
50+
if cfg.DisableEvents {
51+
config.SendEvents = false
52+
}
53+
4454
inner, err := ld.MakeCustomClient(cfg.Key, config, cfg.RequestTimeout)
4555
if err != nil {
4656
logger.WithError(err).Error("Unable to construct LD client")

0 commit comments

Comments
 (0)