-
Notifications
You must be signed in to change notification settings - Fork 0
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
🧹 Allow to override the API endpoint #12
Conversation
This comment has been minimized.
This comment has been minimized.
Fixes #9 Signed-off-by: Christian Zunker <[email protected]>
5b61056
to
015e1cb
Compare
gen/gen.go
Outdated
@@ -176,10 +177,19 @@ fragment TypeRef on __Type { | |||
} | |||
} | |||
` | |||
apiEndpoint := "https://" + apiHost + "/query" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should define apiHost := "us.api.mondoo.com" close to this code since its otherwise difficult to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should parse the url and prepend https if no schema is defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
gen/gen.go
Outdated
apiEndpoint := "https://" + apiHost + "/query" | ||
endpoint, ok := os.LookupEnv("MONDOO_API_ENDPOINT") | ||
if ok { | ||
apiEndpoint, err = url.JoinPath(endpoint, "/query") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should apply that logic to the default api host too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Signed-off-by: Christian Zunker <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @czunker
Fixes #9