no sensitive keys

This commit is contained in:
Diogo Sousa
2023-01-25 19:32:45 +00:00
parent f9988d24e8
commit 856b8a29ce
2 changed files with 16 additions and 1 deletions

View File

@@ -5,6 +5,17 @@ import os
from openbb_terminal.base_helpers import load_env_vars, strtobool
from .helper_classes import TerminalStyle as _TerminalStyle
SENSITIVE_KEYS = [
"RH_USERNAME",
"RH_PASSWORD",
"DG_USERNAME",
"DG_PASSWORD",
"DG_TOTP_SECRET",
"OANDA_ACCOUNT_TYPE",
"OANDA_ACCOUNT",
"OANDA_TOKEN",
]
# Terminal UX section
MPL_STYLE = os.getenv("OPENBB_MPLSTYLE") or "dark"
PMF_STYLE = os.getenv("OPENBB_PMFSTYLE") or "dark"

View File

@@ -240,7 +240,11 @@ def set_key(env_var_name: str, env_var_value: str, persist: bool = False) -> Non
setattr(cfg, env_var_name, env_var_value)
# Send api key to server
if not User.is_guest():
if (
not User.is_guest()
and env_var_name not in cfg.SENSITIVE_KEYS
and env_var_name.startswith("API_")
):
patch_user_configs(key=env_var_name, value=env_var_value, type_="keys")