refactor: Improve variable creation logic in VariableService (#1875)
* refactor: Improve variable creation logic in VariableService
This commit is contained in:
parent
e36901bb34
commit
da256785d0
1 changed files with 14 additions and 11 deletions
|
|
@ -29,6 +29,9 @@ class VariableService(Service):
|
||||||
for var in self.settings_service.settings.variables_to_get_from_environment:
|
for var in self.settings_service.settings.variables_to_get_from_environment:
|
||||||
if var in os.environ:
|
if var in os.environ:
|
||||||
logger.debug(f"Creating {var} variable from environment.")
|
logger.debug(f"Creating {var} variable from environment.")
|
||||||
|
if not session.exec(
|
||||||
|
select(Variable).where(Variable.user_id == user_id, Variable.name == var)
|
||||||
|
).first():
|
||||||
try:
|
try:
|
||||||
self.create_variable(
|
self.create_variable(
|
||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue