Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read auth information from env #279

Merged
merged 6 commits into from
Dec 1, 2023
Merged

Read auth information from env #279

merged 6 commits into from
Dec 1, 2023

Conversation

mythmon
Copy link
Member

@mythmon mythmon commented Nov 29, 2023

This does a few things related to how the authentication is loaded.

  • It will read from an envvar OBSERVABLEHQ_AUTH, overriding the config file if the envvar has a non-empty value.
  • It annotates where the auth value was loaded from so we can give more useful error messages to users.
  • It changes the interface of the auth-getting function to always return an API key. If it can't find a key, it will give the user an error message and exit the program.
    • The test version of the function throws an error instead.
    • In the future we could prompt the user to login with their browser at this point as well.
    • If we ever have a case where we want to make the API key optional we could further extend this function with a required: boolean parameter.

@mythmon mythmon requested review from mbostock and mcglincy November 29, 2023 17:58
src/toolConfig.ts Outdated Show resolved Hide resolved
src/auth.ts Outdated Show resolved Hide resolved
test/auth-test.ts Outdated Show resolved Hide resolved
test/auth-test.ts Outdated Show resolved Hide resolved
@mythmon mythmon enabled auto-merge (squash) December 1, 2023 22:34
@mythmon mythmon merged commit 5ce3da8 into main Dec 1, 2023
1 check passed
@mythmon mythmon deleted the mythmon/auth-env branch December 1, 2023 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants