From 1e30be32d9d8ae4de4c0914e628377cb16cd649f Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Fri, 12 May 2023 22:07:55 -0400 Subject: [PATCH] Support Global System (Apprise) Configuration (#875) --- README.md | 14 ++++++++++++ apprise/cli.py | 48 +++++++++++++++++++++++++++++++++++----- packaging/man/apprise.md | 8 ++++++- 3 files changed, 63 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 08a3d5f2..f6c69625 100644 --- a/README.md +++ b/README.md @@ -221,18 +221,28 @@ No one wants to put their credentials out for everyone to see on the command lin # ~/.apprise.yml # ~/.config/apprise # ~/.config/apprise.yml +# /etc/apprise +# /etc/apprise.yml # Also a subdirectory handling allows you to leverage plugins # ~/.apprise/apprise # ~/.apprise/apprise.yml # ~/.config/apprise/apprise # ~/.config/apprise/apprise.yml +# /etc/apprise/apprise +# /etc/apprise/apprise.yml # Windows users can store their default configuration files here: # %APPDATA%/Apprise/apprise # %APPDATA%/Apprise/apprise.yml # %LOCALAPPDATA%/Apprise/apprise # %LOCALAPPDATA%/Apprise/apprise.yml +# %ALLUSERSPROFILE%\Apprise\apprise +# %ALLUSERSPROFILE%\Apprise\apprise.yml +# %PROGRAMFILES%\Apprise\apprise +# %PROGRAMFILES%\Apprise\apprise.yml +# %COMMONPROGRAMFILES%\Apprise\apprise +# %COMMONPROGRAMFILES%\Apprise\apprise.yml # If you loaded one of those files, your command line gets really easy: apprise -vv -t 'my title' -b 'my notification body' @@ -293,10 +303,14 @@ Once you've defined your custom hook, you just need to tell Apprise where it is # all plugin files (if present) from the following directory paths: # ~/.apprise/plugins # ~/.config/apprise/plugins +# /var/lib/apprise/plugins # Windows users can store their default plugin files in these directories: # %APPDATA%/Apprise/plugins # %LOCALAPPDATA%/Apprise/plugins +# %ALLUSERSPROFILE%\Apprise\plugins +# %PROGRAMFILES%\Apprise\plugins +# %COMMONPROGRAMFILES%\Apprise\plugins # If you placed your plugin file within one of the directories already defined # above, then your call simply needs to look like: diff --git a/apprise/cli.py b/apprise/cli.py index 5ac8af2e..a3335bbb 100644 --- a/apprise/cli.py +++ b/apprise/cli.py @@ -80,28 +80,64 @@ DEFAULT_CONFIG_PATHS = ( '~/.apprise/apprise.yml', '~/.config/apprise/apprise', '~/.config/apprise/apprise.yml', + + # Global Configuration Support + '/etc/apprise', + '/etc/apprise.yml', + '/etc/apprise/apprise', + '/etc/apprise/apprise.yml', ) # Define our paths to search for plugins DEFAULT_PLUGIN_PATHS = ( '~/.apprise/plugins', '~/.config/apprise/plugins', + + # Global Plugin Support + '/var/lib/apprise/plugins', ) # Detect Windows if platform.system() == 'Windows': # Default Config Search Path for Windows Users DEFAULT_CONFIG_PATHS = ( - expandvars('%APPDATA%/Apprise/apprise'), - expandvars('%APPDATA%/Apprise/apprise.yml'), - expandvars('%LOCALAPPDATA%/Apprise/apprise'), - expandvars('%LOCALAPPDATA%/Apprise/apprise.yml'), + expandvars('%APPDATA%\\Apprise\\apprise'), + expandvars('%APPDATA%\\Apprise\\apprise.yml'), + expandvars('%LOCALAPPDATA%\\Apprise\\apprise'), + expandvars('%LOCALAPPDATA%\\Apprise\\apprise.yml'), + + # + # Global Support + # + + # C:\ProgramData\Apprise\ + expandvars('%ALLUSERSPROFILE%\\Apprise\\apprise'), + expandvars('%ALLUSERSPROFILE%\\Apprise\\apprise.yml'), + + # C:\Program Files\Apprise + expandvars('%PROGRAMFILES%\\Apprise\\apprise'), + expandvars('%PROGRAMFILES%\\Apprise\\apprise.yml'), + + # C:\Program Files\Common Files + expandvars('%COMMONPROGRAMFILES%\\Apprise\\apprise'), + expandvars('%COMMONPROGRAMFILES%\\Apprise\\apprise.yml'), ) # Default Plugin Search Path for Windows Users DEFAULT_PLUGIN_PATHS = ( - expandvars('%APPDATA%/Apprise/plugins'), - expandvars('%LOCALAPPDATA%/Apprise/plugins'), + expandvars('%APPDATA%\\Apprise\\plugins'), + expandvars('%LOCALAPPDATA%\\Apprise\\plugins'), + + # + # Global Support + # + + # C:\ProgramData\Apprise\plugins + expandvars('%ALLUSERSPROFILE%\\Apprise\\plugins'), + # C:\Program Files\Apprise\plugins + expandvars('%PROGRAMFILES%\\Apprise\\plugins'), + # C:\Program Files\Common Files + expandvars('%COMMONPROGRAMFILES%\\Apprise\\plugins'), ) diff --git a/packaging/man/apprise.md b/packaging/man/apprise.md index 951c83e9..e59efb0a 100644 --- a/packaging/man/apprise.md +++ b/packaging/man/apprise.md @@ -151,6 +151,7 @@ files and loads them: ~/.apprise/plugins ~/.config/apprise/plugins + /var/lib/apprise/plugins Simply create your own python file with the following bare minimum content in it: @@ -192,6 +193,11 @@ in the following local locations for configuration files and loads them: ~/.config/apprise/apprise ~/.config/apprise/apprise.yaml + /etc/apprise + /etc/apprise.yml + /etc/apprise/apprise + /etc/apprise/apprise.yml + If a default configuration file is referenced in any way by the **apprise** tool, you no longer need to provide it a Service URL. Usage of the **apprise** tool simplifies to: @@ -215,4 +221,4 @@ If you find any bugs, please make them known at: ## COPYRIGHT -Apprise is Copyright (C) 2021 Chris Caron +Apprise is Copyright (C) 2023 Chris Caron