OAuthClientID returns the OAuth client ID, preferring the ALGOLIA_OAUTH_CLIENT_ID environment variable over the compiled-in default (set via ldflags).
()
| 17 | // OAuthClientID returns the OAuth client ID, preferring the ALGOLIA_OAUTH_CLIENT_ID |
| 18 | // environment variable over the compiled-in default (set via ldflags). |
| 19 | func OAuthClientID() string { |
| 20 | if v := os.Getenv("ALGOLIA_OAUTH_CLIENT_ID"); v != "" { |
| 21 | return v |
| 22 | } |
| 23 | if DefaultOAuthClientID == "" { |
| 24 | fmt.Fprintln(os.Stderr, "fatal: ALGOLIA_OAUTH_CLIENT_ID is not set and no default was compiled in") |
| 25 | os.Exit(1) |
| 26 | } |
| 27 | return DefaultOAuthClientID |
| 28 | } |
| 29 | |
| 30 | // RunOAuth runs the OAuth PKCE flow with a local callback server and returns |
| 31 | // a valid access token. A local HTTP server is started on a random port to |
no outgoing calls
no test coverage detected