Skip to content

Commit

Permalink
Fix the entrypoint script for setting sftp.enabled false
Browse files Browse the repository at this point in the history
Move to use jq as my grep was failing.
  • Loading branch information
parkervcp committed Feb 4, 2019
1 parent e7b8925 commit 3cee273
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/ash
## Ensure we are in /srv/daemon

CORE_CHECK=$(grep -o '"enabled": false,' /srv/daemon/config/core.json)

if [ $CORE_CHECK != '"enabled": false,' ]; then
if [ $(cat /srv/daemon/config/core.json | jq -r '.sftp.enabled') == "null" ]; then
echo -e "Updating config to enable sftp-server."
sed -i 's/ "ip": "0.0.0.0",/ "ip": "0.0.0.0",\n "enabled": false,/g' /srv/daemon/config/core.json
else
cat /srv/daemon/config/core.json | jq '.sftp.enabled |= false' > /tmp/core
cat /tmp/core > /srv/daemon/config/core.json
elif [ $(cat /srv/daemon/config/core.json | jq -r '.sftp.enabled') == "false" ]; then
echo -e "Config already set up for golang sftp server"
else
echo -e "You may have purposly set the sftp to true and that will fail."
fi

exec "$@"

0 comments on commit 3cee273

Please sign in to comment.