Skip to content

Commit

Permalink
Refactor to better support server configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Jan 24, 2024
1 parent 683bcf2 commit 9dba095
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions neon_utils/hana_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from ovos_utils.log import LOG
from ovos_utils.xdg_utils import xdg_cache_home

_DEFAULT_BACKEND_URL = "https://hana.neonaialpha.com"
_client_config = {}
_client_config_path = join(xdg_cache_home(), "neon", "hana_token.json")
_headers = {}
Expand Down Expand Up @@ -120,10 +121,10 @@ def request_backend(endpoint: str, request_data: dict,
if not server_config:
from ovos_config.config import Configuration
server_config = Configuration().get("server", {})
if not server_config.get("backend_type") == "hana":
backend_address = "https://hana.neonaialpha.com"
else:
if server_config.get("backend_type") == "hana":
backend_address = server_config.get("url")
else:
backend_address = _DEFAULT_BACKEND_URL
_init_client(backend_address)
if time() >= _client_config.get("expiration", 0):
try:
Expand Down

0 comments on commit 9dba095

Please sign in to comment.