-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display version info when startup
- Loading branch information
1 parent
3baf19e
commit f93edc9
Showing
3 changed files
with
18 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 14 additions & 2 deletions
16
python_boilerplate/configuration/application_configuration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
import configparser | ||
from typing import Final | ||
|
||
from loguru import logger | ||
from pyhocon import ConfigFactory, ConfigTree | ||
|
||
from python_boilerplate.common.common_function import get_resources_dir | ||
from python_boilerplate.common.common_function import ( | ||
PROJECT_ROOT_PATH, | ||
get_resources_dir, | ||
) | ||
|
||
# `application_conf` contains the configuration for the application. | ||
application_conf: ConfigTree = ConfigFactory.parse_file( | ||
get_resources_dir() / "application.conf" | ||
) | ||
|
||
# setup.cfg contains the project constants | ||
setup_cfg: Final = configparser.ConfigParser() | ||
setup_cfg.read(PROJECT_ROOT_PATH / "setup.cfg") | ||
|
||
|
||
def configure() -> None: | ||
""" | ||
Configure application. | ||
""" | ||
logger.warning(f"Application configuration loaded, {application_conf}") | ||
logger.warning( | ||
f"Application configuration loaded, {application_conf}, {setup_cfg.sections()}" | ||
) |