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

feat: Allow specifying Aviator API URL from configuration #194

Conversation

twavv
Copy link
Contributor

@twavv twavv commented Jul 26, 2023

Feature request from a customer to support on-prem installations.

Ideally this would be configurable per-repo as it's possible that a user might have some repositories that use the ~~cloud~~ version of Aviator and some that use on-prem, but that's not very likely at this point and I didn't want to add that complexity to this pull request.

@aviator-app
Copy link
Contributor

aviator-app bot commented Jul 26, 2023

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged using Aviator.


See the real-time status of this PR on the Aviator webapp.

src := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: config.Av.Aviator.APIToken},
)
httpClient := oauth2.NewClient(context.Background(), src)
apiURL := os.Getenv("AV_GRAPHQL_URL")
if apiURL == "" {
apiURL = "https://api.aviator.co/graphql"
baseURL, err := url.Parse(config.Av.Aviator.APIHost)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should config take priority or should env var take priority?

Config taking prio makes sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think environment variables should usually take priority since it's easier to override them in more local contexts. My order is always:

  • Defaults
  • Config files
  • Environment variables
  • Flags

@aviator-app aviator-app bot merged commit fe8be90 into master Jul 26, 2023
@aviator-app aviator-app bot deleted the travis/mer-2632-benchling-add-aviator-host-to-av-cli-config branch July 26, 2023 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants