Loading Errors/Errors.py +7 −1 Original line number Diff line number Diff line """ Define errors for this project """ class EnvironementVariableNotFoundError(Exception): """Raised when trying to get a .env variable that doesn't exists""" def __init__(self) -> None: super().__init__("The environement variable you're trying to get doesn't exist") Errors/__init__.py 0 → 100644 +0 −0 Empty file added. README.md +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ A folder tree containing Naninovel scripts # Run run the following command ```bash python .\EOLJsonParser.py python eol_json_parser.py ``` It's possible to add arguments Loading config/__init__.py 0 → 100644 +0 −0 Empty file added. config/AppConfig.py→config/app_config.py +22 −0 Original line number Diff line number Diff line from dotenv import load_dotenv, find_dotenv """Moduel to interact with the OS""" import os from Errors.Errors import EnvironementVariableNotFoundError from dotenv import find_dotenv, load_dotenv from errors.errors import EnvironementVariableNotFoundError class AppConfig: """Class to set up the configuration of the app""" def __init__(self) -> None: load_dotenv(find_dotenv()) def get(self, name): """Return the specified environment variable or raise EnvironementVariableNotFoundError if the variable doesn't exists""" var = os.getenv(name) if not var: Loading Loading
Errors/Errors.py +7 −1 Original line number Diff line number Diff line """ Define errors for this project """ class EnvironementVariableNotFoundError(Exception): """Raised when trying to get a .env variable that doesn't exists""" def __init__(self) -> None: super().__init__("The environement variable you're trying to get doesn't exist")
README.md +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ A folder tree containing Naninovel scripts # Run run the following command ```bash python .\EOLJsonParser.py python eol_json_parser.py ``` It's possible to add arguments Loading
config/AppConfig.py→config/app_config.py +22 −0 Original line number Diff line number Diff line from dotenv import load_dotenv, find_dotenv """Moduel to interact with the OS""" import os from Errors.Errors import EnvironementVariableNotFoundError from dotenv import find_dotenv, load_dotenv from errors.errors import EnvironementVariableNotFoundError class AppConfig: """Class to set up the configuration of the app""" def __init__(self) -> None: load_dotenv(find_dotenv()) def get(self, name): """Return the specified environment variable or raise EnvironementVariableNotFoundError if the variable doesn't exists""" var = os.getenv(name) if not var: Loading