Allow specifying xaseco operators and admins

This commit is contained in:
Manuel Thalmann 2024-11-27 03:48:31 +01:00
parent df1077ffe8
commit f259592064
2 changed files with 30 additions and 1 deletions

View file

@ -12,6 +12,7 @@ data="/data"
runDir="/opt/xaseco" runDir="/opt/xaseco"
entrypoint="$cache/aseco.php" entrypoint="$cache/aseco.php"
config="$runDir/config.xml" config="$runDir/config.xml"
adminConfig="$runDir/adminops.xml"
dbConfig="$runDir/localdatabase.xml" dbConfig="$runDir/localdatabase.xml"
dediConfig="$runDir/dedimania.xml" dediConfig="$runDir/dedimania.xml"
pluginConfig="$runDir/plugins.xml" pluginConfig="$runDir/plugins.xml"
@ -20,6 +21,8 @@ serverPath="$settingsPath/tmserver"
pluginTag="plugin" pluginTag="plugin"
pluginPath="/aseco_plugins" pluginPath="/aseco_plugins"
userPattern="^(.+?)(@([[:digit:]]+(.[[:digit:]]+){3}))?\$"
tmOptions=( tmOptions=(
TM_SERVER_HOST ip TM_SERVER_HOST ip
TM_SERVER_PORT port TM_SERVER_PORT port
@ -28,6 +31,11 @@ tmOptions=(
TM_TIMEOUT timeout TM_TIMEOUT timeout
) )
groups=(
ADMINS admins
OPERATORS operators
)
sqlOptions=( sqlOptions=(
MYSQL_HOST mysql_server MYSQL_HOST mysql_server
MYSQL_USER mysql_login MYSQL_USER mysql_login
@ -114,6 +122,23 @@ for i in $(seq 0 2 $((${#tmOptions[@]} - 1))); do
fi fi
done done
for i in $(seq 0 2 $((${#groups[@]} - 1))); do
var="${groups[$i]}"
group="${groups[$(($i + 1))]}"
value="${!var}"
path="/lists/$group"
echo "$value" | while read user; do
name="$(echo "$user" | LC_ALL="C" perl -pe "s/$userPattern/\1/")"
ip="$(echo "$user" | LC_ALL="C" perl -pe "s/$userPattern/\3/")"
xmlstarlet edit --inplace --subnode "$path" --type elem -n "tmlogin" --value "$name" "$adminConfig"
if [ -n "$ip" ]; then
xmlstarlet edit --inplace --subnode "$path" --type elem -n "ipaddress" --value "$ip" "$adminConfig"
fi
done
done
for i in $(seq 0 2 $((${#sqlOptions[@]} - 1))); do for i in $(seq 0 2 $((${#sqlOptions[@]} - 1))); do
var="${sqlOptions[$i]}" var="${sqlOptions[$i]}"
option="${sqlOptions[$(($i + 1))]}" option="${sqlOptions[$(($i + 1))]}"

View file

@ -11,7 +11,8 @@ RUN apk update \
# xmlstarlet dependencies # xmlstarlet dependencies
musl \ musl \
libxslt \ libxslt \
libxml2 libxml2 \
perl
RUN update-ca-certificates RUN update-ca-certificates
RUN docker-php-ext-install mysql RUN docker-php-ext-install mysql
COPY --from=base /usr/bin/xmlstarlet /usr/bin COPY --from=base /usr/bin/xmlstarlet /usr/bin
@ -29,6 +30,9 @@ ENV \
MASTERADMIN_USER="" \ MASTERADMIN_USER="" \
MASTERADMIN_IP="" \ MASTERADMIN_IP="" \
\ \
ADMINS="" \
OPERATORS="" \
\
X1_EXTRA_PLUGINS="" \ X1_EXTRA_PLUGINS="" \
X1_DISABLED_PLUGINS="" \ X1_DISABLED_PLUGINS="" \
\ \