This commit is contained in:
teh_coderer
2023-04-04 12:34:21 -05:00
committed by GitHub
parent f02fe35848
commit 10e2b38711
2 changed files with 18 additions and 9 deletions

View File

@@ -1,7 +1,6 @@
# pylint: disable=R0902
import importlib
import inspect
import os
import sys
from pathlib import Path
from typing import Any, Dict, List, Optional, Type, Union
@@ -219,7 +218,11 @@ class PlotlyTA(PltTA):
@staticmethod
def _locate_plugins() -> None:
"""Locate all the plugins in the plugins folder"""
path = REPOSITORY_DIRECTORY if hasattr(sys, "frozen") else Path(os.getcwd())
path = (
Path(sys.executable).parent
if hasattr(sys, "frozen")
else REPOSITORY_DIRECTORY
)
current_system = get_current_system()
# This is for debugging purposes

View File

@@ -1,4 +1,5 @@
# IMPORTS STANDARD
import sys
from typing import Any, Dict, Optional
# IMPORTS THIRDPARTY
@@ -11,18 +12,23 @@ from openbb_terminal.core.config.paths import (
SETTINGS_ENV_FILE,
)
DEFAULT_ORDER = [
SETTINGS_ENV_FILE,
PACKAGE_ENV_FILE,
REPOSITORY_ENV_FILE,
]
def read_env() -> Dict[str, Any]:
__env_dict: Dict[str, Optional[str]] = {}
local_order = DEFAULT_ORDER.copy()
if SETTINGS_ENV_FILE.exists():
__env_dict.update(**dotenv_values(SETTINGS_ENV_FILE))
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
local_order.reverse()
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))
for env_file in local_order:
if env_file.exists():
__env_dict.update(**dotenv_values(env_file))
__env_dict_filtered = {
k[len("OPENBBB_") - 1 :]: v