MCPcopy Create free account
hub / github.com/GetStream/stream-go2 / NewFromEnv

Function NewFromEnv

client.go:74–80  ·  view source on GitHub ↗

NewFromEnv build a new Client using environment variables values, with possible values being STREAM_API_KEY, STREAM_API_SECRET, STREAM_API_REGION, and STREAM_API_VERSION. Additional options can still be provided as parameters.

(extraOptions ...ClientOption)

Source from the content-addressed store, hash-verified

72// and STREAM_API_VERSION.
73// Additional options can still be provided as parameters.
74func NewFromEnv(extraOptions ...ClientOption) (*Client, error) {
75 key := os.Getenv("STREAM_API_KEY")
76 secret := os.Getenv("STREAM_API_SECRET")
77 region := os.Getenv("STREAM_API_REGION")
78 version := os.Getenv("STREAM_API_VERSION")
79 return New(key, secret, append(extraOptions, WithAPIRegion(region), WithAPIVersion(version))...)
80}
81
82// ClientOption is a function used for adding specific configuration options to
83// a Stream client.

Callers 1

TestNewFromEnvFunction · 0.85

Calls 3

NewFunction · 0.85
WithAPIRegionFunction · 0.85
WithAPIVersionFunction · 0.85

Tested by 1

TestNewFromEnvFunction · 0.68