ocean-subgraph/docker/wait_for
Matthias Kretschmann f1a8269036
Activate dependabot, build tweaks, green CI (#6)
* activate dependabot

* package updates

* move auto-generated typings, adapt .gitignore

* lint fix

* eslint config tweaks, turn off eqeqeq rule

* kick out Travis, switch to GitHub Actions

* Update the readme file.

* Add totalOceanLiquidity and fix TVL calculation

* add logs to track pool shares.

* lockedValue fix

* update variable names

* Feature/devel instructions (#19)

* improve developer docs

* fix readme

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* update gitignore

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* .env, and infura key

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

Co-authored-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* merged/dependabot-tvl-fix (#21)

* Update the readme file.

* Add totalOceanLiquidity and fix TVL calculation

* add logs to track pool shares.

* update variable names

* fix error after merge

Co-authored-by: ssallam <travis@travis-ci.org>

* use const

Co-authored-by: ssallam <travis@travis-ci.org>
Co-authored-by: Alex Coseru <alex.coseru@gmail.com>
Co-authored-by: mihaisc <mihai.scarlat@smartcontrol.ro>
Co-authored-by: Samer <36411297+ssallam@users.noreply.github.com>
2021-02-09 11:13:31 +01:00

84 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
# POSIX compatible clone of wait-for-it.sh
# This copy is from https://github.com/eficode/wait-for/commits/master
# at commit 8d9b4446
TIMEOUT=15
QUIET=0
echoerr() {
if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
}
usage() {
exitcode="$1"
cat << USAGE >&2
Usage:
$cmdname host:port [-t timeout] [-- command args]
-q | --quiet Do not output any status messages
-t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout
-- COMMAND ARGS Execute command with args after the test finishes
USAGE
exit "$exitcode"
}
wait_for() {
for i in `seq $TIMEOUT` ; do
nc -z "$HOST" "$PORT" > /dev/null 2>&1
result=$?
if [ $result -eq 0 ] ; then
if [ $# -gt 0 ] ; then
exec "$@"
fi
exit 0
fi
sleep 1
done
echo "Operation timed out" >&2
exit 1
}
while [ $# -gt 0 ]
do
case "$1" in
*:* )
HOST=$(printf "%s\n" "$1"| cut -d : -f 1)
PORT=$(printf "%s\n" "$1"| cut -d : -f 2)
shift 1
;;
-q | --quiet)
QUIET=1
shift 1
;;
-t)
TIMEOUT="$2"
if [ "$TIMEOUT" = "" ]; then break; fi
shift 2
;;
--timeout=*)
TIMEOUT="${1#*=}"
shift 1
;;
--)
shift
break
;;
--help)
usage 0
;;
*)
echoerr "Unknown argument: $1"
usage 1
;;
esac
done
if [ "$HOST" = "" -o "$PORT" = "" ]; then
echoerr "Error: you need to provide a host and port to test."
usage 2
fi
wait_for "$@"