Skip to content

Commit

Permalink
rename ENV var
Browse files Browse the repository at this point in the history
  • Loading branch information
zehnm committed Oct 30, 2023
1 parent 104c872 commit e4b3abd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ More examples will be published.

Certain features can be configured by environment variables:

| Variable | Values | Description |
|------------------------------------|------------------|----------------------------------------------------------------------------------------------------------------------|
| UC_CONFIG_HOME | _directory path_ | Configuration directory to save the user configuration from the driver setup.<br>Default: $HOME or current directory |
| UC_INTEGRATION_INTERFACE | _address_ | Listening interface for WebSocket server.<br>Default: `0.0.0.0` |
| UC_INTEGRATION_HTTP_PORT | _number_ | WebSocket listening port.<br>Default: `port` field in driver metadata json file, if not specified: `9090` |
| UC_INTEGRATION_MDNS_LOCAL_HOSTNAME | _hostname_ | Published local hostname in mDNS service announcement.<br>Default: _short hostname_ with `.local` domain. |
| UC_DISABLE_MDNS_PUBLISH | `true` / `false` | Disables mDNS service advertisement.<br>Default: `false` |
| Variable | Values | Description |
|--------------------------|------------------|----------------------------------------------------------------------------------------------------------------------|
| UC_CONFIG_HOME | _directory path_ | Configuration directory to save the user configuration from the driver setup.<br>Default: $HOME or current directory |
| UC_INTEGRATION_INTERFACE | _address_ | Listening interface for WebSocket server.<br>Default: `0.0.0.0` |
| UC_INTEGRATION_HTTP_PORT | _number_ | WebSocket listening port.<br>Default: `port` field in driver metadata json file, if not specified: `9090` |
| UC_MDNS_LOCAL_HOSTNAME | _hostname_ | Published local hostname in mDNS service announcement.<br>Default: _short hostname_ with `.local` domain. |
| UC_DISABLE_MDNS_PUBLISH | `true` / `false` | Disables mDNS service advertisement.<br>Default: `false` |

## Versioning

Expand Down
4 changes: 2 additions & 2 deletions ucapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,12 +704,12 @@ def local_hostname() -> str:
"""
Get the local hostname for mDNS publishing.
Overridable by environment variable ``UC_INTEGRATION_MDNS_LOCAL_HOSTNAME``.
Overridable by environment variable ``UC_MDNS_LOCAL_HOSTNAME``.
:return: the local hostname
"""
# Override option for announced hostname.
# Useful on macOS where it's broken for several years: local hostname keeps on changing!
# https://apple.stackexchange.com/questions/189350/my-macs-hostname-keeps-adding-a-2-to-the-end

return os.getenv("UC_INTEGRATION_MDNS_LOCAL_HOSTNAME") or f"{socket.gethostname().split('.', 1)[0]}.local."
return os.getenv("UC_MDNS_LOCAL_HOSTNAME") or f"{socket.gethostname().split('.', 1)[0]}.local."

0 comments on commit e4b3abd

Please sign in to comment.