Skip to content

Commit

Permalink
fix(build): issues/274 proxy run messaging (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera committed May 8, 2020
1 parent 5ef48b5 commit 8c38fdd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"api:dev": "mock -p 5000 -w ./src/services",
"api:docs": "node ./scripts/openapi.docs.js",
"api:proxy-hosts": "sh ./scripts/proxy.api.sh -s",
"api:proxy": "sh ./scripts/proxy.api.sh -d \"ci.foo.redhat.com\" -p 443 -c \"$(pwd)/config/spandx.config.js\"",
"api:proxy": "sh ./scripts/proxy.api.sh -d \"https://ci.foo.redhat.com/beta/subscriptions/\" -p 443 -c \"$(pwd)/config/spandx.config.js\"",
"api:proxyClean": "sh ./scripts/proxy.api.sh -u",
"build": "run-s -l build:pre build:js build:post test:integration",
"build:js": "react-scripts build",
Expand All @@ -64,7 +64,7 @@
"release": "standard-version",
"start": "run-s dev:chrome; run-p -l api:dev start:js",
"start:js": "react-scripts start",
"start:proxy": "sh -ac '. ./.env.proxy; open https://ci.foo.redhat.com/beta/subscriptions/; run-s api:proxy-hosts; run-p -l start:js api:proxy'",
"start:proxy": "sh -ac '. ./.env.proxy; run-s api:proxy-hosts; run-p -l start:js api:proxy'",
"start:standalone": "rm ./.env.development.local; run-p -l api:dev start:js",
"test": "run-s test:lint test:ci",
"test:ci": "export CI=true; react-scripts test --env=jsdom --roots=./src --coverage",
Expand Down
13 changes: 11 additions & 2 deletions scripts/proxy.api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ runProxy()

if [ ! -z "$(docker ps | grep $RUN_CONTAINER)" ]; then
printf " ${YELLOW}Container: $(docker ps | grep $RUN_CONTAINER | cut -c 1-50)${NOCOLOR}\n"
echo " Development proxy running: http://${RUN_DOMAIN}:${RUN_PORT}/"
echo " Development proxy running on ${RUN_PORT}: ${RUN_DOMAIN}"
printf " To stop: $ ${YELLOW}docker stop ${RUN_NAME}${NOCOLOR}\n"
open "${RUN_DOMAIN}"
fi

exit 0
Expand All @@ -168,8 +169,8 @@ runProxy()
YELLOW="\e[33m"
NOCOLOR="\e[39m"

DOMAIN="localhost"
PORT=1337
DOMAIN=""
CONFIG=""
UPDATE=false
HOST_ONLY=false
Expand All @@ -193,6 +194,14 @@ runProxy()
esac
done

if [ -z "$DOMAIN" ]; then
if (( $PORT % 2 )); then
DOMAIN="https://localhost:$PORT"
else
DOMAIN="http://localhost:$PORT"
fi
fi

if [ "$UPDATE" = true ]; then
printf "${YELLOW}Updating ${CONTAINER_NAME}, Docker and data...${NOCOLOR}\n"
docker stop -t 0 $CONTAINER_NAME
Expand Down

0 comments on commit 8c38fdd

Please sign in to comment.