Skip to content

Commit

Permalink
A Few Update to Config
Browse files Browse the repository at this point in the history
  • Loading branch information
AcerP-py committed Dec 30, 2024
1 parent 1e9d003 commit 1389936
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ dependencies = [
"pyyaml",
"networkx",
"colorama",
"loguru"
"loguru",
"typing_extensions"
]

[project.urls]
Expand Down
8 changes: 6 additions & 2 deletions src/velocity/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand All @@ -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

0 comments on commit 1389936

Please sign in to comment.