Skip to content

Commit

Permalink
disable CDN option (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenny-statsig authored Jan 30, 2024
1 parent 55ce0d8 commit 5325d68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions statsig.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Options struct {
OutputLoggerOptions OutputLoggerOptions
StatsigLoggerOptions StatsigLoggerOptions
EvaluationCallbacks EvaluationCallbacks
DisableCDN bool // Disables use of CDN for downloading config specs
}

type EvaluationCallbacks struct {
Expand Down
7 changes: 6 additions & 1 deletion transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ func (opts *RequestOptions) fill_defaults() {
}

func (transport *transport) download_config_specs(sinceTime int64, responseBody interface{}) (*http.Response, error) {
endpoint := fmt.Sprintf("/download_config_specs/%s.json?sinceTime=%d", transport.sdkKey, sinceTime)
var endpoint string
if transport.options.DisableCDN {
endpoint = fmt.Sprintf("/download_config_specs?sinceTime=%d", sinceTime)
} else {
endpoint = fmt.Sprintf("/download_config_specs/%s.json?sinceTime=%d", transport.sdkKey, sinceTime)
}
return transport.get(endpoint, responseBody, RequestOptions{})
}

Expand Down

0 comments on commit 5325d68

Please sign in to comment.