Commit graph

12 commits

Author SHA1 Message Date
b464f20e6c stree.StringTree.find(): Add method
StringTree.find(key, val) (and Config.find(), for that matter)
returns a list of paths with sections containing children matching
key / val pairs. One of them can be None, which acts as a wildcard.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-05-29 12:05:10 +02:00
8f464fe278 Config: Add method __setitem__()
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-05-20 13:11:14 +02:00
7cd94fa3db Config: Add .root
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-05-20 13:10:53 +02:00
4b4d8ebdb0 Config: Add property name
There's currently no way to access the root node content, add the
property name for that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-05-12 18:53:04 +02:00
34de9114c5 Config: Support glob_paths_env_key
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-03-12 13:37:32 +01:00
74902349b6 Config: Add method entries()
Config has no way to tell if a given path has children, so add the
entries() method.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-02-15 08:20:53 +01:00
79a3696eaa Config: Make branch() throw exception on inexistent path
Config.branch(path) just silently returns the entire tree if path
doesn't exist in the config. Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-02-15 08:19:25 +01:00
e688cd2364 Config: Support refuse_mode_mask
refuse_mode_mask can be passed to the constructor and determines
which permission bits need to be absent from config file modes if
they smell like they contain secrets.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-01-30 09:54:03 +01:00
7399388f60 Fix errors reported by mypy
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-01-29 16:51:07 +01:00
bee3e28ff5 Config: Accept strings as value for glob_paths
Make Config's ctor accept strings as values for glob_paths, as
opposed to lists. This covers the canonical case of one configuration
file being passed.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-01-29 12:56:32 +01:00
8c0b975e1b Config: Mutually exclude loading from tree or files
Initializing Config from a StringTree object doesn't stop it from
looking for config files to read. Stop that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-01-28 08:05:16 +01:00
84a4053157 Add class Config
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-01-20 11:39:56 +01:00