Browse Source

new: dev: factorize configuration files loading code

myceliandre/dev/mac-compat
Valentin Lab 5 years ago
parent
commit
b34f521c51
  1. 22
      bin/compose

22
bin/compose

@ -116,23 +116,13 @@ mk_docker_run_options() {
##
if [ -z "$DISABLE_SYSTEM_CONFIG_FILE" ]; then
if [ -r /etc/default/charm ]; then
docker_run_opts+=("-v" "/etc/default/charm:/etc/default/charm:ro")
. /etc/default/charm
fi
## XXXvlab: should provide YML config opportunities in possible parent dirs ?
## userdir ? and global /etc/compose.yml ?
for cfgfile in /etc/compose.conf /etc/compose.local.conf \
/etc/default/compose /etc/compose/local.conf; do
for cfgfile in "${compose_config_files[@]}"; do
[ -e "$cfgfile" ] || continue
docker_run_opts+=("-v" "$cfgfile:$cfgfile:ro")
. "$cfgfile"
done
for cfgfile in /etc/default/datastore; do
[ -e "$cfgfile" ] || continue
docker_run_opts+=("-v" "$cfgfile:$cfgfile:ro")
done
else
docker_run_opts+=("-e" "DISABLE_SYSTEM_CONFIG_FILE=$DISABLE_SYSTEM_CONFIG_FILE")
fi
@ -220,6 +210,16 @@ mk_docker_run_options() {
run() {
local os docker_run_opts
## Order matters, files get to override vars
compose_config_files=(
/etc/default/charm
/etc/default/datastore
/etc/compose.conf
/etc/compose.local.conf
/etc/default/compose
/etc/compose/local.conf
)
os=$(get_os)
case "$os" in
linux)

Loading…
Cancel
Save