Skip to content

Commit

Permalink
web_server tweaked addon url handling
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoDerp committed Feb 27, 2024
1 parent 9d85851 commit 29bcfa9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/emhass/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ def action_call(action_name):
#Obtain url and key from ENV or ARG
hass_url = os.getenv("EMHASS_URL", default=args.url)
key = os.getenv("SUPERVISOR_TOKEN", default=args.key)
if hass_url != "http://supervisor/core/api":
key = os.getenv("EMHASS_KEY", key)
key = os.getenv("EMHASS_KEY", key)
#If url or key is None, Set as empty string to reduce NoneType errors bellow
if key is None: key = ""
if hass_url is None: hass_url = ""
Expand Down Expand Up @@ -271,11 +270,11 @@ def action_call(action_name):
# Some data from options
logging_level = options.get('logging_level','INFO')
url_from_options = options.get('hass_url', 'empty')
if url_from_options == 'empty' or url_from_options == '':
url = hass_url+"/config"
if url_from_options == 'empty' or url_from_options == '' or url_from_options == "http://supervisor/core/api":
url = "http://supervisor/core/api/config"
else:
hass_url = url_from_options
url = hass_url+"/api/config"
url = hass_url+"api/config"
token_from_options = options.get('long_lived_token', 'empty')
if token_from_options == 'empty' or token_from_options == '':
long_lived_token = key
Expand Down

0 comments on commit 29bcfa9

Please sign in to comment.