printf'On MacOS docker is run by your local user (not root).\nYour user has no write permission for "/etc/hosts".\nRunning: "sudo chown %s /etc/hosts"\n'"${WHOAMI}"
# Check if there is an entry for $HOST_NAME in the users ssh config
if ! grep -qe "$(printf'^Host %s$'"${HOST_NAME}")""${HOME}/.ssh/config" 2>/dev/null
then
printf'\nHost %s\n Port 3022\n User sqlproxy\n IdentityFile ~/.ssh/%s'"${HOST_NAME}""${KEY_NAME}" >> "${HOME}/.ssh/config"
else
printf'User ssh configuration located in "%s" already has a configuration for host "%s".\nMake sure your configuration matches the following:\n'"${HOME}/.ssh/config""${HOST_NAME}"
printf'"""\nHost %s\n Port 3022\n User sqlproxy\n IdentityFile ~/.ssh/%s\n"""\n'"${HOST_NAME}""${KEY_NAME}"
fi
# Check if public key is already in the containers authorized_keys file
PUB_KEY="$(cat ${HOME}/.ssh/${KEY_NAME}.pub)"
if ! grep -qe "$(printf'%s$'"${PUB_KEY}")""${PROJECT_PATH}/etc/ssh/.ssh/authorized_keys"
printf'Not generating client ssh key.\nPlease put your desired public keys into %s\nAlso add %s in front of your key\n'"${PROJECT_PATH}/etc/ssh/.ssh/authorized_keys""'command=\"/sqlproxy_cli.sh\" '"