rework feature_flags.py to supply defaults to os.getenv()

This commit is contained in:
clothespin
2021-03-16 21:35:21 -07:00
parent 9a2ee39a10
commit 7d2d7a4db8

View File

@@ -1,16 +1,23 @@
import os
USE_COLOR = os.getenv("GTFF_USE_COLOR").lower() not in ["false", "0"] or True
USE_FLAIR = os.getenv("GTFF_USE_FLAIR") or "stars"
USE_ION = os.getenv("GTFF_USE_ION").lower() not in ["false", "0"] or True
USE_PROMPT_TOOLKIT = (
os.getenv("GTFF_USE_PROMPT_TOOLKIT").lower() not in ["false", "0"] or False
)
# env vars are strings not booleans
# check for "false" or "0"
# any other value is true (including empty string)
USE_COLOR = os.getenv("GTFF_USE_COLOR", "true").lower() not in ["false", "0"]
USE_FLAIR = os.getenv("GTFF_USE_FLAIR", "stars")
USE_ION = os.getenv("GTFF_USE_ION", "true").lower() not in ["false", "0"]
USE_PROMPT_TOOLKIT = os.getenv("GTFF_USE_PROMPT_TOOLKIT", "false").lower() not in [
"false",
"0",
]
# Enable Prediction features
ENABLE_PREDICT = os.getenv("GTFF_ENABLE_PREDICT").lower() not in ["false", "0"] or False
ENABLE_PREDICT = os.getenv("GTFF_ENABLE_PREDICT", "false").lower() not in ["false", "0"]
# Enable plot autoscaling
USE_PLOT_AUTOSCALING = (
os.getenv("GTFF_USE_PLOT_AUTOSCALING").lower() not in ["false", "0"] or False
)
USE_PLOT_AUTOSCALING = os.getenv("GTFF_USE_PLOT_AUTOSCALING", "false").lower() not in [
"false",
"0",
]