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"
entrypoint="$cache/aseco.php"
config="$runDir/config.xml"
adminConfig="$runDir/adminops.xml"
dbConfig="$runDir/localdatabase.xml"
dediConfig="$runDir/dedimania.xml"
pluginConfig="$runDir/plugins.xml"
@ -20,6 +21,8 @@ serverPath="$settingsPath/tmserver"
pluginTag="plugin"
pluginPath="/aseco_plugins"
userPattern="^(.+?)(@([[:digit:]]+(.[[:digit:]]+){3}))?\$"
tmOptions=(
TM_SERVER_HOST ip
TM_SERVER_PORT port
@ -28,6 +31,11 @@ tmOptions=(
TM_TIMEOUT timeout
)
groups=(
ADMINS admins
OPERATORS operators
)
sqlOptions=(
MYSQL_HOST mysql_server
MYSQL_USER mysql_login
@ -114,6 +122,23 @@ for i in $(seq 0 2 $((${#tmOptions[@]} - 1))); do
fi
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
var="${sqlOptions[$i]}"
option="${sqlOptions[$(($i + 1))]}"

View file

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