1- """ Substitution of osparc variables and secrets
2-
3- """
1+ """Substitution of osparc variables and secrets"""
42
53import functools
64import logging
2422from pydantic import BaseModel
2523from servicelib .fastapi .app_state import SingletonInAppStateMixin
2624from servicelib .logging_utils import log_context
25+ from simcore_service_director_v2 .core .settings import get_application_settings
2726
2827from ...utils .db import get_repository
2928from ...utils .osparc_variables import (
@@ -194,6 +193,7 @@ async def resolve_and_substitute_session_variables_in_model(
194193 # if it raises an error vars need replacement
195194 raise_if_unresolved_osparc_variable_identifier_found (model )
196195 except UnresolvedOsparcVariableIdentifierError :
196+ app_settings = get_application_settings (app )
197197 table = OsparcSessionVariablesTable .get_from_app_state (app )
198198 identifiers = await resolve_variables_from_context (
199199 table .copy (),
@@ -204,7 +204,9 @@ async def resolve_and_substitute_session_variables_in_model(
204204 project_id = project_id ,
205205 node_id = node_id ,
206206 run_id = service_run_id ,
207- api_server_base_url = app .state .settings .DIRECTOR_V2_PUBLIC_API_BASE_URL ,
207+ api_server_base_url = f"{ app_settings .DIRECTOR_V2_PUBLIC_API_BASE_URL } " .rstrip (
208+ "/"
209+ ),
208210 ),
209211 )
210212 _logger .debug ("replacing with the identifiers=%s" , identifiers )
@@ -238,6 +240,7 @@ async def resolve_and_substitute_session_variables_in_specs(
238240 identifiers_to_replace ,
239241 )
240242 if identifiers_to_replace :
243+ app_settings = get_application_settings (app )
241244 environs = await resolve_variables_from_context (
242245 table .copy (include = identifiers_to_replace ),
243246 context = ContextDict (
@@ -247,7 +250,9 @@ async def resolve_and_substitute_session_variables_in_specs(
247250 project_id = project_id ,
248251 node_id = node_id ,
249252 run_id = service_run_id ,
250- api_server_base_url = app .state .settings .DIRECTOR_V2_PUBLIC_API_BASE_URL ,
253+ api_server_base_url = f"{ app_settings .DIRECTOR_V2_PUBLIC_API_BASE_URL } " .rstrip (
254+ "/"
255+ ),
251256 ),
252257 )
253258
0 commit comments