Skip to content

Container Cluster Reverse Proxy Support#284

Open
JoKneeMo wants to merge 1 commit intojason0x43:masterfrom
JoKneeMo:issue/283
Open

Container Cluster Reverse Proxy Support#284
JoKneeMo wants to merge 1 commit intojason0x43:masterfrom
JoKneeMo:issue/283

Conversation

@JoKneeMo
Copy link
Copy Markdown

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
Copy Markdown
Author

This PR would resolve #283

Copy link
Copy Markdown
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.

port: int | None = user_input.get(H_CONF_SERVER_PORT)
address: str | None = user_input.get(H_CONF_SERVER_INTERFACE)
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
Copy Markdown
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

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
Copy Markdown
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.

return self._hub.port

@property
def address(self) -> str | None:
Copy link
Copy Markdown
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?

return self._hub.event_url

@property
def update_he_url(self) -> bool | None:
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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