Files
OpenBB/openbb_terminal/core/session/env_handler.py
teh_coderer 401a78278d Interactive Charts Improvements (#4586)
* ship it

* edits to bot docs

* Update generate_sdk_markdown.py

* splitting installation

* Update plotly.html

* no pywry print if using sdk

* Update popups.js

* Update plotly.html

* Update popups.js

* update bot index.mdx's, ramenize generate_index.py

* remove older index.md files

* added logic for light themes, refactor `generate_sdk_markdown.py` for reference cards

* reshow modebar

* Update plotly_helper.py

* fix reset reloading of env files

* refactor doc generation files

* Update plotly_helper.py

* cleanup

* Update generate_sdk_markdown.py

* Update plotly_helper.py

* updates

* fix csv_columns select overflow

* for james with love

* remove division `/ 1000`  from options_view

* Update backend.py

* Update popups.js

* csv plot candlestick logic for same Yaxis

* Update plotly_helper.py

* Update plotly.html

---------

Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
2023-03-27 22:04:41 +00:00

47 lines
1.1 KiB
Python

# IMPORTS STANDARD
from typing import Any, Dict, Optional
# IMPORTS THIRDPARTY
from dotenv import dotenv_values, set_key
# IMPORTS INTERNAL
from openbb_terminal.core.config.paths import (
PACKAGE_ENV_FILE,
REPOSITORY_ENV_FILE,
SETTINGS_ENV_FILE,
)
def read_env() -> Dict[str, Any]:
__env_dict: Dict[str, Optional[str]] = {}
if SETTINGS_ENV_FILE.exists():
__env_dict.update(**dotenv_values(SETTINGS_ENV_FILE))
if PACKAGE_ENV_FILE.exists():
__env_dict.update(**dotenv_values(PACKAGE_ENV_FILE))
if REPOSITORY_ENV_FILE.exists():
__env_dict.update(**dotenv_values(REPOSITORY_ENV_FILE))
__env_dict_filtered = {
k[len("OPENBBB_") - 1 :]: v
for k, v in __env_dict.items()
if k.startswith("OPENBB_")
}
return __env_dict_filtered
def write_to_dotenv(name: str, value: str) -> None:
"""Write to .env file.
Parameters
----------
name : str
Name of the variable.
value : str
Value of the variable.
"""
set_key(str(SETTINGS_ENV_FILE), name, str(value))