Test d’une méthode d’agrégation des variables d’environnement.
This commit is contained in:
parent
be14957a0e
commit
49c06fec1a
|
@ -50,11 +50,11 @@ FAKE_SMTP_LOCAL=1
|
||||||
FAKE_SMTP_ACTIVATE=1
|
FAKE_SMTP_ACTIVATE=1
|
||||||
# si actif, il faut sans doute l’utiliser
|
# si actif, il faut sans doute l’utiliser
|
||||||
# comme passerelle pour le service MTA
|
# comme passerelle pour le service MTA
|
||||||
#if [ "$FAKE_SMTP_ACTIVATE" -eq 1 ]
|
if [ "$FAKE_SMTP_ACTIVATE" -eq 1 ]
|
||||||
#then
|
then
|
||||||
# MTA_RELAY_HOST="$FAKE_SMTP_NAME"
|
MTA_RELAY_HOST="$FAKE_SMTP_NAME"
|
||||||
# MTA_RELAY_PORT=2525
|
MTA_RELAY_PORT=2525
|
||||||
#fi
|
fi
|
||||||
|
|
||||||
# MARIADB
|
# MARIADB
|
||||||
MARIADB_SERVICE_NAME=mariadb
|
MARIADB_SERVICE_NAME=mariadb
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env -S -i bash
|
||||||
|
|
||||||
|
env_files="env/.env env/.env.local"
|
||||||
|
merged_env="env/.env.merge"
|
||||||
|
if [ -n "$1" ]
|
||||||
|
then
|
||||||
|
env_files="$env_files $1/env/.env $1/env/.env.local"
|
||||||
|
merged_env="$1/env/.env.merge"
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset PWD
|
||||||
|
unset SHLVL
|
||||||
|
for env_file in $env_files
|
||||||
|
do
|
||||||
|
set -a
|
||||||
|
if [ -f "$env_file" ]
|
||||||
|
then
|
||||||
|
. $env_file
|
||||||
|
fi
|
||||||
|
set +a
|
||||||
|
done
|
||||||
|
unset username
|
||||||
|
export -p | cut -d" " -f3- | sed "/OLDPWD/d" | head -n -1 | sort > "$merged_env"
|
||||||
|
|
||||||
|
exit 0
|
7
nine.sh
7
nine.sh
|
@ -113,7 +113,8 @@ destroyall(){
|
||||||
|
|
||||||
env(){
|
env(){
|
||||||
for dir in $(ls -d "services"/[0-9][0-9]-* | sort); do
|
for dir in $(ls -d "services"/[0-9][0-9]-* | sort); do
|
||||||
mergeenv $dir/env/.env.merge env/.env.merge $dir/env/.env $dir/env/.env.local
|
#mergeenv $dir/env/.env.merge env/.env.merge $dir/env/.env $dir/env/.env.local
|
||||||
|
misc/tools/mergeenv.sh $dir
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,9 +209,9 @@ services() {
|
||||||
#===========================================================================================================================================
|
#===========================================================================================================================================
|
||||||
|
|
||||||
# Include variable d'environnement global
|
# Include variable d'environnement global
|
||||||
mergeenv env/.env.merge env/.env env/.env.local
|
#mergeenv env/.env.merge env/.env env/.env.local
|
||||||
|
misc/tools/mergeenv.sh
|
||||||
. env/.env.merge
|
. env/.env.merge
|
||||||
|
|
||||||
# Include service
|
# Include service
|
||||||
declare -A services
|
declare -A services
|
||||||
for dir in $(ls -d "services"/[0-9][0-9]-* | sort); do
|
for dir in $(ls -d "services"/[0-9][0-9]-* | sort); do
|
||||||
|
|
Loading…
Reference in New Issue