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)
| 72 | // and STREAM_API_VERSION. |
| 73 | // Additional options can still be provided as parameters. |
| 74 | func 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. |