Skip to content

Commit 4f6ad47

Browse files
committed
configuration(feat): Enable read-only access to underlying map template properties
1 parent 4210a1a commit 4f6ad47

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

jsonpycraft/manager/configuration.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import logging
66
import os
77
from logging import Logger
8+
from pathlib import Path
89
from typing import Any, Optional
910

1011
import dotenv
@@ -41,12 +42,34 @@ def __init__(
4142

4243
self._indent = indent
4344

45+
@property
46+
def file_path(self) -> Path:
47+
"""
48+
Get the path to the JSON file.
49+
50+
Returns:
51+
Path: The file path.
52+
"""
53+
return self._map_template.file_path
54+
4455
@property
4556
def keys(self) -> list[str]:
57+
"""
58+
Get a list of all keys in the mapping.
59+
60+
Returns:
61+
list[str]: A list of keys in the mapping.
62+
"""
4663
return self._map_template.keys
4764

4865
@property
4966
def data(self) -> JSONMap:
67+
"""
68+
Get the underlying JSON data structure.
69+
70+
Returns:
71+
JSONData (Union[JSONMap, JSONList]): The underlying data structure.
72+
"""
5073
return self._map_template.data
5174

5275
def mkdir(self) -> None:
@@ -308,9 +331,7 @@ def get_logger(
308331
"%(asctime)s - %(filename)s:%(lineno)d - %(levelname)s - %(message)s"
309332
)
310333

311-
default_log_dir = "/var/log/jsonpycraft/" # Default log directory
312-
log_file_path = self.evaluate_path(key, default_log_dir)
313-
334+
log_file_path = self.evaluate_path(key, "/var/log/jsonpycraft/")
314335
log_level = log_info.get("level", level)
315336
logger = logging.getLogger(logger_name)
316337

0 commit comments

Comments
 (0)