-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Refactor server listen to take 'http(s)' scheme in URL #762
Conversation
This refactor consists of two things: * Accept 'http(s)' as a scheme * Move the code so it's easier to add new protocols to --addr Signed-off-by: Juan Antonio Osorio Robles <jaosorior@redhat.com>
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.
Looks good to me -- the thing I'm not sure about is that this way, it's either http[s] OR unix socket, but never both. If that's the intended way, 👍
This looks good. The only issue I noticed is that the server errors if you supply a URL scheme for --insecure-addr:
(Specifying a host in the --insecure-addr URL does not change anything.) |
@tsandall right, this only applies for addr and not insecure-addr. I'm thinking in a further iteration we could deprecate insecure-addr? I think this should be all handled by addr (since it takes http and https). |
Deprecating --insecure-addr sounds good to me. We can leave --insecure-addr without support for URL schemes then. I'll create a separate issue to deprecate --insecure-addr. I've tried to summarize the new behaviour below. Let me know if this makes sense.
This means that if you want the current https + insecure-addr behaviour you would run OPA as follows (e.g., HTTPS on 0.0.0.0:8181 and HTTP on localhost:8282):
Or alternatively, with URL scheme:
|
With the open-policy-agent#762 and open-policy-agent#764 there is no need to keep the logic for creating the HTTP and HTTPS listeners inside the function. These changes just split listener creation into separate functions for clarity. Also, update runtime to use logrus for reporting initialization errors instead of println for consistency. Signed-off-by: Torin Sandall <torinsandall@gmail.com>
With the #762 and #764 there is no need to keep the logic for creating the HTTP and HTTPS listeners inside the function. These changes just split listener creation into separate functions for clarity. Also, update runtime to use logrus for reporting initialization errors instead of println for consistency. Signed-off-by: Torin Sandall <torinsandall@gmail.com>
This refactor consists of two things:
Accept 'http(s)' as a scheme
Move the code so it's easier to add new protocols to --addr
Signed-off-by: Juan Antonio Osorio Robles jaosorior@redhat.com