From dd41834fa88c26911f658587f7c45e55cf9c03f5 Mon Sep 17 00:00:00 2001 From: David Huss <dh@atoav.com> Date: Thu, 10 Aug 2023 17:47:59 +0200 Subject: [PATCH] Fix error in readme, remove mentions of eigenservice in help) --- README.md | 11 +++++------ common_config/common.py | 19 ++++++++++--------- pyproject.toml | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 93eedd5..a4f726e 100755 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ # common-config -This is a common configuration library for eigenservice +This is a common configuration library for python based services -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): +Add this dependency to your application e.g. using poetry: ```bash - ssh-add - poetry add git+ssh://git@code.hfbk.net:4242/id/eigenservice/common-config.git -vvv + poetry add git+https://code.hfbk.net/id/eigenservice/common-config.git ``` When something changes update it like this: @@ -25,7 +24,7 @@ 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 +from common_config import initialize_config, read_config # Name of this application, used in directory names, etc APPLICATION_NAME = "my_application" @@ -48,7 +47,7 @@ common_config.common.DEFAULT_CONFIG = DEFAULT_CONFIG if __name__ == "__main__": - main() + common_config.main() ``` If people now run that file, they will get an interactive configuration-tool diff --git a/common_config/common.py b/common_config/common.py index 3447a8d..fabbaad 100755 --- a/common_config/common.py +++ b/common_config/common.py @@ -1,8 +1,9 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- import inspect -import os, getpass, sys -import subprocess +import os +import sys +import getpass import logging import toml from pathlib import Path @@ -38,10 +39,10 @@ def get_config_directories() -> List[dict]: Existence of the directories is _not_ checked """ - # Generate a etc directory (usually /etc/eigenservice) + # Generate a etc directory (e.g. /etc/my_service_name) etc_directory = f"/etc/{APPLICATION_NAME}" - # Get the default config dir (usually /home/user/.config/eigenservice) + # Get the default config dir (e.g. /home/user/.config/my_service_name) default_config_home = f"{get_home()}/.config/{APPLICATION_NAME}" # Unless the XDG_CONFIG_HOME environment variable has been set, then use this instead @@ -380,8 +381,8 @@ def create_config(): """ helptext = f"""Configs are read from the following directories (later overrides earlier): 1. DEFAULT_CONFIG (use config default to inspect) -2. /etc/eigenservice/*{SUFFIX}.toml (in alphabetical order) -3. $XDG_CONFIG_HOME/eigenservice/*{SUFFIX}.toml (in alphabetical order) +2. /etc/{APPLICATION_NAME}/*{SUFFIX}.toml (in alphabetical order) +3. $XDG_CONFIG_HOME/{APPLICATION_NAME}/*{SUFFIX}.toml (in alphabetical order) 4. $EIGENSERVICE_CONFIG_DIR/*{SUFFIX}.toml (in alphabetical order) 5. $EIGENSERVICE_CONFIG_PATH (final override) """ @@ -509,12 +510,12 @@ def print_help(): """ helptext = f"""========= {APPLICATION_NAME.upper()} CONFIG ({SUFFIX.upper()}) ========= -Helper tool for managing and installing a eigenservice config. +Helper tool for managing and installing a {APPLICATION_NAME} config. Configs are read from the following directories (later overrides earlier): 1. DEFAULT_CONFIG (see below) -2. /etc/eigenservice/*{SUFFIX}.toml (in alphabetical order) -3. $XDG_CONFIG_HOME/eigenservice/*{SUFFIX}.toml (in alphabetical order) +2. /etc/{APPLICATION_NAME}/*{SUFFIX}.toml (in alphabetical order) +3. $XDG_CONFIG_HOME/{APPLICATION_NAME}/*{SUFFIX}.toml (in alphabetical order) 4. $EIGENSERVICE_CONFIG_DIR/*{SUFFIX}.toml (in alphabetical order) 5. $EIGENSERVICE_CONFIG_PATH (final override) diff --git a/pyproject.toml b/pyproject.toml index 9f71303..6a6c0c0 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "common-config" -version = "0.1.18" -description = "A config library for eigenservice" +version = "0.1.19" +description = "A config library for python based services" authors = ["David Huss <dh@atoav.com>"] [tool.poetry.dependencies] -- GitLab