Skip to content

Commit

Permalink
Merge pull request jxxghp#3189 from InfinityPacer/feature/module
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp authored Nov 21, 2024
2 parents 0953c1b + 103cfe0 commit 350f1fa
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,9 @@ def update_env_config(field: Any, original_value: Any, converted_value: Any) ->
logger.warning(message)

if field.name in os.environ:
if is_converted:
message = f"配置项 '{field.name}' 已在环境变量中设置,请手动更新以保持一致性"
logger.warning(message)
return False, message
message = f"配置项 '{field.name}' 已在环境变量中设置,请手动更新以保持一致性"
logger.warning(message)
return False, message
else:
set_key(SystemUtils.get_env_path(), field.name, str(converted_value) if converted_value is not None else "")
if is_converted:
Expand All @@ -393,7 +392,7 @@ def update_setting(self, key: str, value: Any) -> Tuple[bool, str]:
field.default, key)
# 如果没有抛出异常,则统一使用 converted_value 进行更新
if needs_update or str(value) != str(converted_value):
success, message = self.update_env_config(field, original_value, converted_value)
success, message = self.update_env_config(field, value, converted_value)
# 仅成功更新配置时,才更新内存
if success:
setattr(self, key, converted_value)
Expand Down

0 comments on commit 350f1fa

Please sign in to comment.