Skip to content

Commit

Permalink
Set host uri dev settings in server *before* coupling algorithm store…
Browse files Browse the repository at this point in the history
…s as the env var is required to do so
  • Loading branch information
bartvanb committed Apr 15, 2024
1 parent a49d8fd commit e5b3c6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions vantage6-server/vantage6/server/__init__.py
Expand Up @@ -140,15 +140,15 @@ def __init__(self, ctx: ServerContext) -> None:
self.configure_api()
self.load_resources()

# couple any algoritm stores to the server if defined in config. This should be
# done after the resources are loaded to ensure that rules are set up
self.couple_algorithm_stores()

# set environment variable for dev environment
host_uri = self.ctx.config.get("dev", {}).get("host_uri")
if host_uri:
os.environ[HOST_URI_ENV] = host_uri

# couple any algoritm stores to the server if defined in config. This should be
# done after the resources are loaded to ensure that rules are set up
self.couple_algorithm_stores()

# set the server version
self.__version__ = __version__

Expand Down
3 changes: 2 additions & 1 deletion vantage6-server/vantage6/server/algo_store_communication.py
Expand Up @@ -4,6 +4,7 @@
from flask import Response
from http import HTTPStatus

from vantage6.backend.common.globals import HOST_URI_ENV
from vantage6.server import db


Expand Down Expand Up @@ -149,7 +150,7 @@ def request_algo_store(

if not response and is_localhost_algo_store:
# try again with the docker host ip
host_uri = os.environ.get("HOST_URI_ENV_VAR", None)
host_uri = os.environ.get(HOST_URI_ENV, None)
if not host_uri:
msg = (
"You are trying to connect to a localhost algorithm store, but this "
Expand Down

0 comments on commit e5b3c6d

Please sign in to comment.