-
Notifications
You must be signed in to change notification settings - Fork 47
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
Container Cluster Reverse Proxy Support #284
base: master
Are you sure you want to change the base?
Conversation
This PR would resolve #283 |
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.
Thanks for the contribution! I have a few minor requests, but otherwise this looks good.
event_url: str | None = user_input.get(H_CONF_SERVER_URL) | ||
update_he_url: bool = user_input.get(H_CONF_UPDATE_HE_URL) |
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.
This should be bool | None
@@ -171,6 +175,8 @@ async def async_step_user( | |||
H_CONF_SERVER_URL: user_input.get(H_CONF_SERVER_URL), | |||
H_CONF_SERVER_SSL_CERT: user_input.get(H_CONF_SERVER_SSL_CERT), | |||
H_CONF_SERVER_SSL_KEY: user_input.get(H_CONF_SERVER_SSL_KEY), | |||
H_CONF_SERVER_INTERFACE: user_input.get(H_CONF_SERVER_INTERFACE), | |||
H_CONF_UPDATE_HE_URL: user_input.get(H_CONF_UPDATE_HE_URL), |
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.
For backwards compatibility, I'd prefer this be something that could default to false (e.g., "Don't update event POST URL in Hubitat") because it's going to start out disabled for users after they update.
@@ -124,12 +126,22 @@ def id(self) -> str: | |||
def port(self) -> int | None: | |||
"""The port used for the Hubitat event receiver.""" | |||
return self._hub.port | |||
|
|||
@property | |||
def address(self) -> str | None: |
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.
Is this property used anywhere?
|
||
@property | ||
def event_url(self) -> str | None: | ||
"""The event URL that Hubitat should POST events to.""" | ||
return self._hub.event_url | ||
|
||
@property | ||
def update_he_url(self) -> bool | None: |
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.
Is this property used anywhere?
self._server = server.create_server( | ||
self._process_event, address, self.port or 0, self.ssl_context | ||
self._process_event, self.address, self.port or 0, self.ssl_context |
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.
Make this self.address or '0.0.0.0'
since create_server
expects a string value.
""" | ||
if address is not None: | ||
return address | ||
if host is not None: |
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.
host
should never be None since this is only called from the constructor, and the constructor must be passed a host value.
Allow override of the server listening interface and disable HE POST URL updating.
Adds 2 new optional config options
This should allow anyone running Home Assistant in Docker Swarm or Kubernetes to use this integration.
Without the ability to set the listening interface, hosts with a dynamic container IP can not connect.
UI Example: