mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-14 23:38:15 +01:00
style: Add pre-commit checks and code cleanup
This change adds an optional pre-commit configuration that can be used to keep the code style clean. I've also run it across all files and fixed numerous whitespaces issues. To use it, if wanted, just clone / pull the repo as normal, go into the folder and run: ``` pre-commit install ``` From that point on, when running `git commit`, it will run the checks on any changed files. Feel free to ignore this PR if you're not interested.
This commit is contained in:
parent
39c69b7648
commit
588c22afc9
12 changed files with 72 additions and 64 deletions
|
|
@ -25,13 +25,13 @@ services:
|
|||
Then browse to the webui.
|
||||

|
||||
Here you'll click **Configuration Manager**, read the overview and then click on **Configuration**.
|
||||
Under **Configuration** you'll craft/paste your notification config.
|
||||
Under **Configuration** you'll craft/paste your notification config.
|
||||
|
||||

|
||||
The simplest way is just paste the url's as is (like in the example above).
|
||||
There are many ways to customize with tags, groups, json and more. Read [caronc/apprise-api](https://github.com/caronc/apprise-api) for more info!
|
||||
The simplest way is just paste the url's as is (like in the example above).
|
||||
There are many ways to customize with tags, groups, json and more. Read [caronc/apprise-api](https://github.com/caronc/apprise-api) for more info!
|
||||
|
||||
Look at the [apprise wiki: Notification Services](https://github.com/caronc/apprise/wiki) for more info about how the url syntax for different services works.
|
||||
Look at the [apprise wiki: Notification Services](https://github.com/caronc/apprise/wiki) for more info about how the url syntax for different services works.
|
||||
|
||||
|
||||
You can also use the [caronc/apprise-api](https://github.com/caronc/apprise-api) to host the api as a frontend to an already existing **Apprise**-setup on the host.
|
||||
|
|
@ -40,7 +40,7 @@ You can also use the [caronc/apprise-api](https://github.com/caronc/apprise-api)
|
|||
### Customize the **notify.sh** file.
|
||||
After you're done with the setup of the container and tried your notifications, you can copy the `notify_apprise.sh` file to `notify.sh` and start editing it.
|
||||
|
||||
Comment out/remove the bare metal apprise-command (starting with `apprise -vv -t...`).
|
||||
Comment out/remove the bare metal apprise-command (starting with `apprise -vv -t...`).
|
||||
Uncomment and edit the `AppriseURL` variable and *curl* line
|
||||
It should look something like this when curling the API:
|
||||
```bash
|
||||
|
|
@ -72,11 +72,11 @@ ___
|
|||
|
||||
|
||||
## On host installed **Apprise**
|
||||
Follow the official guide on [caronc/apprise](https://github.com/caronc/apprise)!
|
||||
Follow the official guide on [caronc/apprise](https://github.com/caronc/apprise)!
|
||||
|
||||
### A brief, basic "get started"
|
||||
|
||||
- Install **apprise**
|
||||
- Install **apprise**
|
||||
- python package `pip install apprise`
|
||||
- packaged in EPEL/Fedora `dnf install apprise`
|
||||
- packaged in AUR `[yay/pikaur/paru/other] apprise`
|
||||
|
|
@ -92,7 +92,7 @@ Then either source the notifications with `-c=/path/to/config/apprise` or store
|
|||
- Test apprise with a single notification:
|
||||
- `apprise -vv -t 'test title' -b 'test notification body' 'mailto://myemail:mypass@gmail.com'`
|
||||
- Set up your notification URL's and test them.
|
||||
- Look at the [apprise wiki: Notification Services](https://github.com/caronc/apprise/wiki) for more info about how the url syntax for different services works.
|
||||
- Look at the [apprise wiki: Notification Services](https://github.com/caronc/apprise/wiki) for more info about how the url syntax for different services works.
|
||||
|
||||
### When done, customize the **notify.sh** file.
|
||||
After you're done with the setup of the container and tried your notifications, you can copy the `notify_apprise.sh` file to `notify.sh` and start editing it.
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
|
|||
done
|
||||
|
||||
### Sort arrays alphabetically
|
||||
IFS=$'\n'
|
||||
IFS=$'\n'
|
||||
NoUpdates=($(sort <<<"${NoUpdates[*]}"))
|
||||
GotUpdates=($(sort <<<"${GotUpdates[*]}"))
|
||||
GotErrors=($(sort <<<"${GotErrors[*]}"))
|
||||
|
|
@ -44,7 +44,7 @@ if [[ -n ${GotErrors[*]} ]] ; then
|
|||
printf "\n\033[0;31mContainers with errors, wont get updated:\033[0m\n"
|
||||
printf "%s\n" "${GotErrors[@]}"
|
||||
fi
|
||||
if [[ -n ${GotUpdates[*]} ]] ; then
|
||||
if [[ -n ${GotUpdates[*]} ]] ; then
|
||||
printf "\n\033[0;33mContainers with updates available:\033[0m\n"
|
||||
printf "%s\n" "${GotUpdates[@]}"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
SearchName="$1"
|
||||
for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
|
||||
for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
|
||||
echo "------------ $i ------------"
|
||||
ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}')
|
||||
[ -z "$ContPath" ] && { "$i has no compose labels - skipping" ; continue ; }
|
||||
|
|
@ -8,7 +8,7 @@ for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do
|
|||
ContName=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.service" }}')
|
||||
ContEnv=$(docker inspect "$i" --format '{{index .Config.Labels "com.docker.compose.project.environment_file" }}')
|
||||
ContImage=$(docker inspect "$i" --format='{{.Config.Image}}')
|
||||
|
||||
|
||||
if [[ $ContConfigFile = '/'* ]] ; then
|
||||
ComposeFile="$ContConfigFile"
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue