1
- """ Substitution of osparc variables and secrets
2
-
3
- """
1
+ """Substitution of osparc variables and secrets"""
4
2
5
3
import functools
6
4
import logging
24
22
from pydantic import BaseModel
25
23
from servicelib .fastapi .app_state import SingletonInAppStateMixin
26
24
from servicelib .logging_utils import log_context
25
+ from simcore_service_director_v2 .core .settings import get_application_settings
27
26
28
27
from ...utils .db import get_repository
29
28
from ...utils .osparc_variables import (
@@ -194,6 +193,7 @@ async def resolve_and_substitute_session_variables_in_model(
194
193
# if it raises an error vars need replacement
195
194
raise_if_unresolved_osparc_variable_identifier_found (model )
196
195
except UnresolvedOsparcVariableIdentifierError :
196
+ app_settings = get_application_settings (app )
197
197
table = OsparcSessionVariablesTable .get_from_app_state (app )
198
198
identifiers = await resolve_variables_from_context (
199
199
table .copy (),
@@ -204,7 +204,7 @@ async def resolve_and_substitute_session_variables_in_model(
204
204
project_id = project_id ,
205
205
node_id = node_id ,
206
206
run_id = service_run_id ,
207
- api_server_base_url = app . state . settings .DIRECTOR_V2_PUBLIC_API_BASE_URL ,
207
+ api_server_base_url = app_settings .DIRECTOR_V2_PUBLIC_API_BASE_URL ,
208
208
),
209
209
)
210
210
_logger .debug ("replacing with the identifiers=%s" , identifiers )
@@ -238,6 +238,7 @@ async def resolve_and_substitute_session_variables_in_specs(
238
238
identifiers_to_replace ,
239
239
)
240
240
if identifiers_to_replace :
241
+ app_settings = get_application_settings (app )
241
242
environs = await resolve_variables_from_context (
242
243
table .copy (include = identifiers_to_replace ),
243
244
context = ContextDict (
@@ -247,7 +248,7 @@ async def resolve_and_substitute_session_variables_in_specs(
247
248
project_id = project_id ,
248
249
node_id = node_id ,
249
250
run_id = service_run_id ,
250
- api_server_base_url = app . state . settings .DIRECTOR_V2_PUBLIC_API_BASE_URL ,
251
+ api_server_base_url = app_settings .DIRECTOR_V2_PUBLIC_API_BASE_URL ,
251
252
),
252
253
)
253
254
0 commit comments