HomeDevCentral

Provide configuration paths

Description

Provide configuration paths

Summary:
A common question is how to parse a configuration file
in /usr/local/etc vs /etc, or in current vs home vs system dir.

The function get_configuration_paths is intended to offer the four
solutions. Script is expected to remove the non relevant ones.

The try/except block and the or {} allows to silently ignore
configuration error. They need to be removed when config is mandatory.

Test Plan:
With a .foo.conf file containing alpha:\n foo: 42:

$ python3
>>> import config
>>> config.parse_configuration()
{'alpha': {'foo': 42}}

Reviewers: yousra

Differential Revision: https://devcentral.nasqueron.org/D4082

Details

Provenance
derecksonAuthored on Sun, Apr 19, 09:03
derecksonPushed on Sun, Apr 19, 17:13
Differential Revision
D4082: Provide configuration paths
Parents
rSNIPPETS0fa0141e464d: Disable shellcheck warning for EUID
Branches
Unknown
Tags
Unknown
References
HEAD -> main