Skip to content

Commit

Permalink
Merge pull request #59 from bitholla/develop
Browse files Browse the repository at this point in the history
Dronefile improvements, Token expiry handling improvements.
  • Loading branch information
kycfeel authored Mar 3, 2020
2 parents f2fc0a0 + c17beb9 commit 7e1cca2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
18 changes: 9 additions & 9 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ steps:
when:
branch: master

- name: docker_tag_for_release_master
image: alpine
commands:
- export PACKAGE_VERSION="$(cat version)" && echo "$PACKAGE_VERSION" > .tags_release
- echo "Current Release tag is :" && cat .tags_release
when:
branch: master

- name: docker_tagging_testnet
image: alpine
commands:
Expand Down Expand Up @@ -65,14 +57,22 @@ steps:
when:
branch: testnet

- name: docker_tag_for_release_master
image: alpine
commands:
- export PACKAGE_VERSION="$(cat version)" && echo "$PACKAGE_VERSION" > .tags
- echo "Current Release tag is :" && cat .tags
when:
branch: master

- name: create_github_release
image: ubuntu:19.04
environment:
GITHUB_TOKEN:
from_secret: github_oauth2_token_for_releases
commands:
- apt-get update && apt-get install -y hub git
- hub release create -m "HollaEx CLI v$(cat .tags_release) Release" -t ${DRONE_BRANCH} $(cat .tags_release)
- hub release create -m "HollaEx CLI v$(cat .tags) Release" -t ${DRONE_BRANCH} $(cat .tags)
when:
branch: master

Expand Down
11 changes: 8 additions & 3 deletions hollaex
Original file line number Diff line number Diff line change
Expand Up @@ -1630,13 +1630,14 @@ elif [[ "$1" == "pull" ]]; then

printf "\033[91mFailed to read pre-bound Activation code.\033[39m\n"
echo "'hollaex pull' works only after you successfully logged in."
echo "Please run 'hollaex login' to sign in first."
exit 1;

fi

if [[ "$RUN_WITH_VERIFY" == true ]]; then

printf "\nCurrent bound Exchange name: \033[92m$HOLLAEX_CONFIGMAP_API_NAME\033[39m\n\n"
printf "\nCurrent bound activation code: \033[92m$HOLLAEX_SECRET_ACTIVATION_CODE\033[39m\n\n"
echo "This command will override the current Exchange settings at '/settings' folder of your HollaEx Kit."
echo "Are you sure you want to pull the exchange settings from bitHolla Dashboard? (y/N)"
read answer
Expand All @@ -1660,12 +1661,16 @@ elif [[ "$1" == "pull" ]]; then

fi

BITHOLLA_USER_TOKEN_EXPIRY_CHECK=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer $BITHOLLA_ACCOUNT_TOKEN"\
--request GET \
https://$ENVIRONMENT_BRIDGE_TARGET_SERVER/v1/exchange)

BITHOLLA_USER_EXCHANGE_LIST=$(curl -s -H "Content-Type: application/json" -H "Authorization: Bearer $BITHOLLA_ACCOUNT_TOKEN"\
--request GET \
https://$ENVIRONMENT_BRIDGE_TARGET_SERVER/v1/exchange \
| jq '.')

if [[ ! "$BITHOLLA_USER_EXCHANGE_LIST" ]] || [[ "$BITHOLLA_USER_EXCHANGE_LIST" == *"Token is expired"* ]]; then
if [[ ! "$BITHOLLA_USER_TOKEN_EXPIRY_CHECK" ]] || [[ ! "$BITHOLLA_USER_TOKEN_EXPIRY_CHECK" == "200" ]]; then

printf "\033[91mFailed to pull the exchange data from bitHolla.\033[39m\n\n"
printf "\033[91mError: Your access token has been expired!\033[39m\n"
Expand Down Expand Up @@ -3595,7 +3600,7 @@ elif [[ "$1" == "web" ]]; then
echo "Cleaning up the web Nginx configuration..."
cp -f $TEMPLATE_GENERATE_PATH/local/nginx/conf.d/web.conf $TEMPLATE_GENERATE_PATH/local/nginx/conf.d/.web.conf
rm $TEMPLATE_GENERATE_PATH/local/nginx/conf.d/web.conf

if command docker-compose -f $TEMPLATE_GENERATE_PATH/local/$ENVIRONMENT_EXCHANGE_NAME-docker-compose-web.yaml -p client stop; then

echo "Reloading Nginx..."
Expand Down

0 comments on commit 7e1cca2

Please sign in to comment.