mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-17 09:57:49 +00:00
Merge pull request #62 from mag37/env-rework
Reworked --env-file logic.
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
___
|
___
|
||||||
## :bell: Changelog
|
## :bell: Changelog
|
||||||
|
|
||||||
|
- **v0.3.8**: Fixed `--env-file` logic to work with multiple env-files.
|
||||||
- **v0.3.7**: Added support for [labels](#bookmark-labels), added the `-f` option (force restart stack).
|
- **v0.3.7**: Added support for [labels](#bookmark-labels), added the `-f` option (force restart stack).
|
||||||
- **v0.3.6**: Added pushbullet template.
|
- **v0.3.6**: Added pushbullet template.
|
||||||
- **v0.3.5**: Added a simple progress bar for the registry checkup.
|
- **v0.3.5**: Added a simple progress bar for the registry checkup.
|
||||||
|
|||||||
15
dockcheck.sh
15
dockcheck.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION="v0.3.7"
|
VERSION="v0.3.8"
|
||||||
### ChangeNotes: Added label support (see readme) and -f (force restart stack) option.
|
### ChangeNotes: Fixed --env-file logic to work with multiple env-files.
|
||||||
Github="https://github.com/mag37/dockcheck"
|
Github="https://github.com/mag37/dockcheck"
|
||||||
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
||||||
|
|
||||||
@@ -301,17 +301,20 @@ if [ -n "$GotUpdates" ] ; then
|
|||||||
cd "$ContPath" || { echo "Path error - skipping $i" ; continue ; }
|
cd "$ContPath" || { echo "Path error - skipping $i" ; continue ; }
|
||||||
printf "\n%bNow updating (%s/%s): %b%s%b\n" "$c_teal" "$CurrentQue" "$NumberofUpdates" "$c_blue" "$i" "$c_reset"
|
printf "\n%bNow updating (%s/%s): %b%s%b\n" "$c_teal" "$CurrentQue" "$NumberofUpdates" "$c_blue" "$i" "$c_reset"
|
||||||
### Checking if Label Only -option is set, and if container got the label
|
### Checking if Label Only -option is set, and if container got the label
|
||||||
[[ "$OnlyLabel" == true ]] && { [[ "$ContUpdateLabel" != true ]] && { echo "No label, skipping" ; continue ; } }
|
[[ "$OnlyLabel" == true ]] && { [[ "$ContUpdateLabel" != true ]] && { echo "No update label, skipping." ; continue ; } }
|
||||||
docker pull "$ContImage"
|
docker pull "$ContImage"
|
||||||
### Reformat for multi-compose:
|
### Reformat for multi-compose:
|
||||||
IFS=',' read -r -a Confs <<< "$ComposeFile" ; unset IFS
|
IFS=',' read -r -a Confs <<< "$ComposeFile" ; unset IFS
|
||||||
for conf in "${Confs[@]}"; do CompleteConfs+="-f $conf " ; done
|
for conf in "${Confs[@]}"; do CompleteConfs+="-f $conf " ; done
|
||||||
### Check if the container got an environment file set, use it if so:
|
### Check if the container got an environment file set, use it if so:
|
||||||
if [ -n "$ContEnv" ]; then # also checking if stack should be restarted
|
if [ -n "$ContEnv" ]; then
|
||||||
|
### prepare env-files arguments
|
||||||
|
ContEnvs=$(for env in ${ContEnv//,/ } ; do printf -- "--env-file %s " $env; done)
|
||||||
|
### Check if the whole stack should be restarted
|
||||||
if [[ "$ContRestartStack" == true ]] || [[ "$ForceRestartStacks" == true ]] ; then
|
if [[ "$ContRestartStack" == true ]] || [[ "$ForceRestartStacks" == true ]] ; then
|
||||||
$DockerBin ${CompleteConfs[@]} stop ; $DockerBin ${CompleteConfs[@]} --env-file "$ContEnv" up -d
|
$DockerBin ${CompleteConfs[@]} stop ; $DockerBin ${CompleteConfs[@]} ${ContEnvs} up -d
|
||||||
else
|
else
|
||||||
$DockerBin ${CompleteConfs[@]} --env-file "$ContEnv" up -d "$ContName" # unquoted array to allow split - rework?
|
$DockerBin ${CompleteConfs[@]} ${ContEnvs} up -d "$ContName" # unquoted array to allow split - rework?
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ "$ContRestartStack" == true ]] || [[ "$ForceRestartStacks" == true ]] ; then
|
if [[ "$ContRestartStack" == true ]] || [[ "$ForceRestartStacks" == true ]] ; then
|
||||||
|
|||||||
Reference in New Issue
Block a user