mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
fix(Docker): config loading for ac-dev-server container (#14755)
## Changes Proposed: - This properly moves things from `DOCKER_ETC_FOLDER` to `confDir` - originally broken with888a718cf3## Issues Addressed: - Should hopefully close https://github.com/azerothcore/acore-docker/issues/12 ## SOURCE: ## Tests Performed: - I'm not exactly aware of the testing procedure for this, as I don't use acore-docker - That said, the previous behavior has been replicated:2420d19e54/apps/compiler/includes/functions.sh (L148-L150)- Open to suggestions ## How to Test the Changes: 1. Open to Suggestions ## Known Issues and TODO List: - Test properly ## How to Test AzerothCore PRs When a PR is ready to be tested, it will be marked as **[WAITING TO BE TESTED]**. You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here: http://www.azerothcore.org/wiki/How-to-test-a-PR **REMEMBER**: when testing a PR that changes something **generic** (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but **especially** check that the PR does not cause any regression (i.e. introducing new bugs). **For example**: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but **we should test Y and Z as well**.
This commit is contained in:
@@ -147,11 +147,25 @@ function comp_compile() {
|
|||||||
|
|
||||||
if [[ $DOCKER = 1 && $DISABLE_DOCKER_CONF != 1 ]]; then
|
if [[ $DOCKER = 1 && $DISABLE_DOCKER_CONF != 1 ]]; then
|
||||||
echo "Generating confs..."
|
echo "Generating confs..."
|
||||||
|
|
||||||
|
# Search for all configs under DOCKER_ETC_FOLDER
|
||||||
for dockerdist in "$DOCKER_ETC_FOLDER"/*.dockerdist; do
|
for dockerdist in "$DOCKER_ETC_FOLDER"/*.dockerdist; do
|
||||||
base_conf="$(echo "$dockerdist" | rev | cut -f1 -d. --complement | rev)"
|
# Grab "base" conf. turns foo.conf.dockerdist into foo.conf
|
||||||
cp -nv "$base_conf.dist" "$base_conf"
|
baseConf="$(echo "$dockerdist" | rev | cut -f1 -d. --complement | rev)"
|
||||||
# Move configs from .conf.dockerdist to .conf
|
# env/dist/etc/foo.conf becomes foo.conf
|
||||||
conf_layer "$dockerdist" "$base_conf" " # Copied from dockerdist"
|
filename="$(basename "$baseConf")"
|
||||||
|
# the dist files should be always found inside $confDir
|
||||||
|
# which may not be the same as DOCKER_ETC_FOLDER
|
||||||
|
distPath="$confDir/$filename.dist"
|
||||||
|
# if dist file doesn't exist, skip this iteration
|
||||||
|
[ ! -f "$distPath" ] && continue
|
||||||
|
|
||||||
|
# replace params in foo.conf.dist with params in foo.conf.dockerdist
|
||||||
|
conf_layer "$dockerdist" "$distPath" " # Copied from dockerdist"
|
||||||
|
|
||||||
|
# Copy modified dist file to $confDir/$filename
|
||||||
|
# Don't overwrite foo.conf if it already exists.
|
||||||
|
cp --no-clobber --verbose "$distPath" "$confDir/$filename"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -179,13 +193,18 @@ function conf_layer() {
|
|||||||
BASE="$2"
|
BASE="$2"
|
||||||
COMMENT="$3"
|
COMMENT="$3"
|
||||||
|
|
||||||
|
# Loop over all defined params in conf file
|
||||||
grep -E "^[a-zA-Z\.0-9]+\s*=.*$" "$LAYER" \
|
grep -E "^[a-zA-Z\.0-9]+\s*=.*$" "$LAYER" \
|
||||||
| while read -r param
|
| while read -r param
|
||||||
do
|
do
|
||||||
|
# remove spaces from param
|
||||||
|
# foo = bar becomes foo=bar
|
||||||
NOSPACE="$(tr -d '[:space:]' <<< "$param")"
|
NOSPACE="$(tr -d '[:space:]' <<< "$param")"
|
||||||
|
|
||||||
|
# split into key and value
|
||||||
KEY="$(cut -f1 -d= <<< "$NOSPACE")"
|
KEY="$(cut -f1 -d= <<< "$NOSPACE")"
|
||||||
VAL="$(cut -f2 -d= <<< "$NOSPACE")"
|
VAL="$(cut -f2 -d= <<< "$NOSPACE")"
|
||||||
# if key not in base or val not in line
|
# if key in base and val not in line
|
||||||
if grep -qE "^$KEY" "$BASE" && ! grep -qE "^$KEY.*=.*$VAL" "$BASE"; then
|
if grep -qE "^$KEY" "$BASE" && ! grep -qE "^$KEY.*=.*$VAL" "$BASE"; then
|
||||||
# Replace line
|
# Replace line
|
||||||
# Prevent issues with shell quoting
|
# Prevent issues with shell quoting
|
||||||
|
|||||||
Reference in New Issue
Block a user