This is a simple python package for interfacing with systemd's LoadCredential mechanism.
It allows reading secrets from the credentials directory, with a fallback on environment variables if needed.
from loadcredential import Credentials
credentials = Credentials()
secret1 = credentials["SECRET_1"]- Add a
fail_missingparameter tocredentials.get_json, for a behavior similar tocredentials[key]
- Use a tighter type for
credentials.getreturningstr | TwhereTis the type of the default value, instead ofstr | None
- Added
credentials.get(key, default=None)which returns a default value and does not raise an error when the key is absent - Added
credentials.get_json(key, default = None)which treats the imported secret as json data
Initial version