From bd5f8c62c864b96f35f771b6822b07995c9b3f30 Mon Sep 17 00:00:00 2001 From: Paul Sanders Date: Mon, 27 Jun 2022 13:57:15 -0400 Subject: [PATCH] Make reading of environment variables case insensitive (#712) * Make reading of environment variables case insensitive * Update CHANGELOG Co-authored-by: Paul Sanders --- CHANGELOG.md | 3 +++ src/fidesops/core/config.py | 8 ++++---- src/fidesops/util/logger.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7445fe6d1..ca8ad0d21a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ The types of changes are: * ### Docs * Updated the tutorial installation to use main in fidesdemo [#715](https://github.com/ethyca/fidesops/pull/715) +### Fixed +* Make reading of environment variables case insensitive [712](https://github.com/ethyca/fidesops/pull/712) + ## [1.6.0](https://github.com/ethyca/fidesops/compare/1.5.3...1.6.0) diff --git a/src/fidesops/core/config.py b/src/fidesops/core/config.py index 7eecb1a57c..623c01bf16 100644 --- a/src/fidesops/core/config.py +++ b/src/fidesops/core/config.py @@ -140,9 +140,9 @@ class FidesopsConfig(FidesSettings): admin_ui: AdminUiSettings PORT: int - is_test_mode: bool = os.getenv("TESTING") == "True" - hot_reloading: bool = os.getenv("FIDESOPS__HOT_RELOAD") == "True" - dev_mode: bool = os.getenv("FIDESOPS__DEV_MODE") == "True" + is_test_mode: bool = os.getenv("TESTING", "").lower() == "true" + hot_reloading: bool = os.getenv("FIDESOPS__HOT_RELOAD", "").lower() == "true" + dev_mode: bool = os.getenv("FIDESOPS__DEV_MODE", "").lower() == "true" class Config: # pylint: disable=C0115 case_sensitive = True @@ -151,7 +151,7 @@ class Config: # pylint: disable=C0115 f"Startup configuration: reloading = {hot_reloading}, dev_mode = {dev_mode}" ) logger.warning( - f'Startup configuration: pii logging = {os.getenv("FIDESOPS__LOG_PII") == "True"}' + f'Startup configuration: pii logging = {os.getenv("FIDESOPS__LOG_PII", "").lower() == "true"}' ) def log_all_config_values(self) -> None: diff --git a/src/fidesops/util/logger.py b/src/fidesops/util/logger.py index fead7bc77e..dc5e2bf235 100644 --- a/src/fidesops/util/logger.py +++ b/src/fidesops/util/logger.py @@ -26,7 +26,7 @@ def factory( # pylint: disable=R0913 func: str = None, sinfo: str = None, ) -> logging.LogRecord: - env_log_pii: bool = os.getenv("FIDESOPS__LOG_PII") == "True" + env_log_pii: bool = os.getenv("FIDESOPS__LOG_PII", "").lower() == "true" new_args = args if not env_log_pii: new_args = tuple(_mask_pii_for_logs(arg) for arg in args)