Add ability to manually create a db (#6151)

This commit is contained in:
Dan Albert 2019-09-27 12:03:20 -07:00 committed by GitHub
parent bf199a2ebc
commit db18611c86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -12,11 +12,12 @@ usage() {
echo "Error: $*"
fi
cat <<EOF
usage: $0 [-e] [-d] [username]
usage: $0 [-e] [-d] [-c database_name] [username]
Creates a testnet dev metrics 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
-e Assume database already exists and SOLANA_METRICS_CONFIG is
defined in the environment already
@ -25,17 +26,20 @@ EOF
exit $exitcode
}
loadConfigFile
useEnv=false
delete=false
createWithoutConfig=false
host="https://metrics.solana.com:8086"
while getopts "hde" opt; do
while getopts "hdec:" opt; do
case $opt in
h|\?)
usage
exit 0
;;
c)
createWithoutConfig=true
netBasename=$OPTARG
;;
d)
delete=true
;;
@ -62,6 +66,10 @@ else
password="$(urlencode "$password")"
if ! $createWithoutConfig; then
loadConfigFile
fi
query() {
echo "$*"
curl -XPOST \