From 13899363de83f7f1cb9cc825b669dfb3f57a0c5a Mon Sep 17 00:00:00 2001 From: Asa Rentschler Date: Mon, 30 Dec 2024 14:17:05 -0500 Subject: [PATCH] A Few Update to Config --- pyproject.toml | 3 ++- src/velocity/_config.py | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 80f662d..8614cfa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,8 @@ dependencies = [ "pyyaml", "networkx", "colorama", - "loguru" + "loguru", + "typing_extensions" ] [project.urls] diff --git a/src/velocity/_config.py b/src/velocity/_config.py index 282d195..6016788 100644 --- a/src/velocity/_config.py +++ b/src/velocity/_config.py @@ -3,7 +3,8 @@ from loguru import logger from platform import processor as arch from pathlib import Path -from os import getlogin as get_username, getenv +from os import getenv +from getpass import getuser from yaml import safe_load as yaml_safe_load from ._exceptions import InvalidConfigIdentifier from ._tools import OurMeta @@ -99,6 +100,9 @@ def __str__(self) -> str: if getenv("VELOCITY_BUILD_DIR") is not None: _config.set("velocity:build_dir", getenv("VELOCITY_BUILD_DIR")) +if getenv("VELOCITY_LOGGING_LEVEL") is not None: + _config.set("velocity:logging:level", getenv("VELOCITY_LOGGING_LEVEL")) + # set defaults for un-configured items if _config.get("velocity:system", warn_on_miss=False) is None: _config.set("velocity:system", arch()) @@ -118,7 +122,7 @@ def __str__(self) -> str: _config.set("velocity:image_path", image_dir.__str__()) if _config.get("velocity:build_dir", warn_on_miss=False) is None: - _config.set("velocity:build_dir", Path("/tmp").joinpath(get_username(), "velocity").__str__()) + _config.set("velocity:build_dir", Path("/tmp").joinpath(getuser(), "velocity").__str__()) # export config = _config