Skip to content

Commit

Permalink
fix bool env read bug
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-sky committed May 14, 2023
1 parent 303e4dd commit c0e57e0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,10 @@ def read_env_variable(arg, default_value):
print(f"[ENV_VAR] 尝试加载{arg},默认值:{default_value} --> 修正值:{env_arg}")
try:
if isinstance(default_value, bool):
r = bool(env_arg)
env_arg = env_arg.strip()
if env_arg == 'True': r = True
elif env_arg == 'False': r = False
else: print('enter True or False, but have:', env_arg); r = default_value
elif isinstance(default_value, int):
r = int(env_arg)
elif isinstance(default_value, float):
Expand Down

0 comments on commit c0e57e0

Please sign in to comment.