Skip to content

Commit

Permalink
Support setting NEXTCLOUD_AUTH_TOKEN
Browse files Browse the repository at this point in the history
Allows to set up the nextcloud auth token during install.

Purpose is to make the install smoother by exposing it and have server
info and metrics available to verify the status of the install.

As this is only supported in v22 and later, for now a version check is
included.

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
  • Loading branch information
mrueg committed Jan 17, 2022
1 parent 365c4f8 commit b63993e
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 0 deletions.
5 changes: 5 additions & 0 deletions 21/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
file_env NEXTCLOUD_AUTH_TOKEN
if [ -n "${NEXTCLOUD_AUTH_TOKEN+x}" ] && version_greater "$image_version" "21.99.99.99"; then
echo "setting auth token"
run_as "php /var/www/html/occ config:app:set serverinfo token --value $NEXTCLOUD_AUTH_TOKEN"
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
5 changes: 5 additions & 0 deletions 21/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
file_env NEXTCLOUD_AUTH_TOKEN
if [ -n "${NEXTCLOUD_AUTH_TOKEN+x}" ] && version_greater "$image_version" "21.99.99.99"; then
echo "setting auth token"
run_as "php /var/www/html/occ config:app:set serverinfo token --value $NEXTCLOUD_AUTH_TOKEN"
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
5 changes: 5 additions & 0 deletions 21/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
file_env NEXTCLOUD_AUTH_TOKEN
if [ -n "${NEXTCLOUD_AUTH_TOKEN+x}" ] && version_greater "$image_version" "21.99.99.99"; then
echo "setting auth token"
run_as "php /var/www/html/occ config:app:set serverinfo token --value $NEXTCLOUD_AUTH_TOKEN"
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
5 changes: 5 additions & 0 deletions 22/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
file_env NEXTCLOUD_AUTH_TOKEN
if [ -n "${NEXTCLOUD_AUTH_TOKEN+x}" ] && version_greater "$image_version" "21.99.99.99"; then
echo "setting auth token"
run_as "php /var/www/html/occ config:app:set serverinfo token --value $NEXTCLOUD_AUTH_TOKEN"
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
5 changes: 5 additions & 0 deletions 22/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
file_env NEXTCLOUD_AUTH_TOKEN
if [ -n "${NEXTCLOUD_AUTH_TOKEN+x}" ] && version_greater "$image_version" "21.99.99.99"; then
echo "setting auth token"
run_as "php /var/www/html/occ config:app:set serverinfo token --value $NEXTCLOUD_AUTH_TOKEN"
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
5 changes: 5 additions & 0 deletions 22/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
file_env NEXTCLOUD_AUTH_TOKEN
if [ -n "${NEXTCLOUD_AUTH_TOKEN+x}" ] && version_greater "$image_version" "21.99.99.99"; then
echo "setting auth token"
run_as "php /var/www/html/occ config:app:set serverinfo token --value $NEXTCLOUD_AUTH_TOKEN"
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
5 changes: 5 additions & 0 deletions 23/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
file_env NEXTCLOUD_AUTH_TOKEN
if [ -n "${NEXTCLOUD_AUTH_TOKEN+x}" ] && version_greater "$image_version" "21.99.99.99"; then
echo "setting auth token"
run_as "php /var/www/html/occ config:app:set serverinfo token --value $NEXTCLOUD_AUTH_TOKEN"
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
5 changes: 5 additions & 0 deletions 23/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
file_env NEXTCLOUD_AUTH_TOKEN
if [ -n "${NEXTCLOUD_AUTH_TOKEN+x}" ] && version_greater "$image_version" "21.99.99.99"; then
echo "setting auth token"
run_as "php /var/www/html/occ config:app:set serverinfo token --value $NEXTCLOUD_AUTH_TOKEN"
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
5 changes: 5 additions & 0 deletions 23/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
file_env NEXTCLOUD_AUTH_TOKEN
if [ -n "${NEXTCLOUD_AUTH_TOKEN+x}" ] && version_greater "$image_version" "21.99.99.99"; then
echo "setting auth token"
run_as "php /var/www/html/occ config:app:set serverinfo token --value $NEXTCLOUD_AUTH_TOKEN"
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ If you set any group of values (i.e. all of `MYSQL_DATABASE`, `MYSQL_USER`, `MYS

- `NEXTCLOUD_ADMIN_USER` Name of the Nextcloud admin user.
- `NEXTCLOUD_ADMIN_PASSWORD` Password for the Nextcloud admin user.
- `NEXTCLOUD_AUTH_TOKEN` Authentication token to access server info.

If you want, you can set the data directory, otherwise default value will be used.

Expand Down
5 changes: 5 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
file_env NEXTCLOUD_AUTH_TOKEN
if [ -n "${NEXTCLOUD_AUTH_TOKEN+x}" ] && version_greater "$image_version" "21.99.99.99"; then
echo "setting auth token"
run_as "php /var/www/html/occ config:app:set serverinfo token --value $NEXTCLOUD_AUTH_TOKEN"
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down

0 comments on commit b63993e

Please sign in to comment.