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

Container Cluster Reverse Proxy Support #284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JoKneeMo
Copy link

Allow override of the server listening interface and disable HE POST URL updating.
Adds 2 new optional config options

  • server_interface
  • update_he_url

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:
image

@JoKneeMo
Copy link
Author

This PR would resolve #283

Copy link
Owner

@jason0x43 jason0x43 left a 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)
Copy link
Owner

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),
Copy link
Owner

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:
Copy link
Owner

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:
Copy link
Owner

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
Copy link
Owner

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:
Copy link
Owner

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.

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