mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-22 09:04:21 +01:00
Merge branch 'configurable_uid_gid'
This commit is contained in:
@@ -164,6 +164,8 @@ RUN arch="$(uname -m)"; \
|
||||
EXPOSE ${PORT}
|
||||
|
||||
ENV SIGNAL_CLI_CONFIG_DIR=/home/.local/share/signal-cli
|
||||
ENV SIGNAL_CLI_UID=1000
|
||||
ENV SIGNAL_CLI_GID=1000
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
|
||||
@@ -5,8 +5,11 @@ set -e
|
||||
|
||||
[ -z "${SIGNAL_CLI_CONFIG_DIR}" ] && echo "SIGNAL_CLI_CONFIG_DIR environmental variable needs to be set! Aborting!" && exit 1;
|
||||
|
||||
usermod -u ${SIGNAL_CLI_UID} signal-api
|
||||
groupmod -g ${SIGNAL_CLI_GID} signal-api
|
||||
|
||||
# Fix permissions to ensure backward compatibility
|
||||
chown 1000:1000 -R ${SIGNAL_CLI_CONFIG_DIR}
|
||||
chown ${SIGNAL_CLI_UID}:${SIGNAL_CLI_GID} -R ${SIGNAL_CLI_CONFIG_DIR}
|
||||
|
||||
# Show warning on docker exec
|
||||
cat <<EOF >> /root/.bashrc
|
||||
@@ -27,4 +30,4 @@ supervisorctl start all
|
||||
fi
|
||||
|
||||
# Start API as signal-api user
|
||||
exec setpriv --reuid=1000 --regid=1000 --init-groups --inh-caps=$caps signal-cli-rest-api -signal-cli-config=${SIGNAL_CLI_CONFIG_DIR}
|
||||
exec setpriv --reuid=${SIGNAL_CLI_UID} --regid=${SIGNAL_CLI_GID} --init-groups --inh-caps=$caps signal-cli-rest-api -signal-cli-config=${SIGNAL_CLI_CONFIG_DIR}
|
||||
|
||||
@@ -73,7 +73,7 @@ func main() {
|
||||
log.Fatal("Couldn't create fifo with name ", fifoPathname, ": ", err.Error())
|
||||
}
|
||||
|
||||
_, err = exec.Command("chown", "1000:1000", fifoPathname).Output()
|
||||
_, err = exec.Command("chown", "${SIGNAL_CLI_UID}:${SIGNAL_CLI_GID}", fifoPathname).Output()
|
||||
if err != nil {
|
||||
log.Fatal("Couldn't change permissions of fifo with name ", fifoPathname, ": ", err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user