Add ability to manually create a db (#6151) (#6154)

automerge
This commit is contained in:
mergify[bot]
2019-09-27 12:42:17 -07:00
committed by Grimes
parent 11bc11f0b7
commit 06e34ef1cf

View File

@ -12,11 +12,12 @@ usage() {
echo "Error: $*" echo "Error: $*"
fi fi
cat <<EOF cat <<EOF
usage: $0 [-e] [-d] [username] usage: $0 [-e] [-d] [-c database_name] [username]
Creates a testnet dev metrics database Creates a testnet dev metrics database
username InfluxDB user with access to create a new database username InfluxDB user with access to create a new database
-c Manually specify a database to create, rather than read from config file
-d Delete the database instead of creating it -d Delete the database instead of creating it
-e Assume database already exists and SOLANA_METRICS_CONFIG is -e Assume database already exists and SOLANA_METRICS_CONFIG is
defined in the environment already defined in the environment already
@ -25,17 +26,20 @@ EOF
exit $exitcode exit $exitcode
} }
loadConfigFile
useEnv=false useEnv=false
delete=false delete=false
createWithoutConfig=false
host="https://metrics.solana.com:8086" host="https://metrics.solana.com:8086"
while getopts "hde" opt; do while getopts "hdec:" opt; do
case $opt in case $opt in
h|\?) h|\?)
usage usage
exit 0 exit 0
;; ;;
c)
createWithoutConfig=true
netBasename=$OPTARG
;;
d) d)
delete=true delete=true
;; ;;
@ -62,6 +66,10 @@ else
password="$(urlencode "$password")" password="$(urlencode "$password")"
if ! $createWithoutConfig; then
loadConfigFile
fi
query() { query() {
echo "$*" echo "$*"
curl -XPOST \ curl -XPOST \