From f4ea5fac41c1e1033c8cdff729e4d6d8feb66136 Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Tue, 9 Aug 2016 13:36:00 +0100 Subject: [PATCH] added token support --- scripts/start.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 2e0bf93..20dc0d9 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -33,12 +33,21 @@ if [ ! -d "/var/www/html/.git" ]; then # Pull down code from git for our site! if [ ! -z "$GIT_REPO" ]; then # Remove the test index file - rm -Rf /var/www/html/index.php + rm -Rf /var/www/html/index.html if [ ! -z "$GIT_BRANCH" ]; then - git clone -b $GIT_BRANCH $GIT_REPO /var/www/html + if [ -z "$GIT_USERNAME" ] && [ -z "$GIT_PERSONAL_TOKEN" ]; then + git clone -b $GIT_BRANCH $GIT_REPO /var/www/html/ + else + git clone -b ${GIT_BRANCH} https://${GIT_USERNAME}:${GIT_PERSONAL_TOKEN}@${GIT_REPO} /var/www/html + fi else - git clone $GIT_REPO /var/www/html + if [ -z "$GIT_USERNAME" ] && [ -z "$GIT_PERSONAL_TOKEN" ]; then + git clone $GIT_REPO /var/www/html/ + else + git clone https://${GIT_USERNAME}:${GIT_PERSONAL_TOKEN}@${GIT_REPO} /var/www/html + fi fi + chown -Rf nginx.nginx /var/www/html fi fi