common-config
This is a common configuration library for eigenservice
Add this dependency to your application e.g. using poetry (ssh-add so you don't have to type the ssh-password over and over):
ssh-add
poetry add git+ssh://git@code.hfbk.net:4242/id/eigenservice/common-config.git -vvv
When something changes update it like this:
poetry update common-config
Then in the application use something like this as a starting point:
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import common_config
from common_config import initialize_config, read_settings, main
# Name of this application, used in directory names, etc
APPLICATION_NAME = "my_application"
# suffix added to the config files (e.g. `00-suffix.toml`)
SUFFIX = "config"
# Do not change here, just use an override instead
DEFAULT_CONFIG = """
[application]
loglevel = "info"
level = 9001
mood = "very"
"""
# Override the global variables in the common-config.common module
common_config.common.APPLICATION_NAME = APPLICATION_NAME
common_config.common.SUFFIX = SUFFIX
common_config.common.DEFAULT_CONFIG = DEFAULT_CONFIG
if __name__ == "__main__":
main()
If people now run that file, they will get an interactive configuration-tool