Skip to content

Commit

Permalink
Fix #16 , Prompt user to enter password to avoid history
Browse files Browse the repository at this point in the history
  • Loading branch information
rach committed Jan 4, 2016
1 parent c66cbde commit 804786e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ var (
Short('h').PlaceHolder("HOSTNAME").Default("localhost").String()
port = app.Flag("port", "database server port (default: 2345)").
Short('p').Default("2345").PlaceHolder("PORT").Int()
password = app.Flag("password", "").
Short('W').PlaceHolder("PASSWORD").String()
password = app.Flag("password", "").Short('W').Bool()
username = addUsernameFlag(app)
database = app.Arg("DBNAME", "").Required().String()
)
Expand All @@ -45,7 +44,12 @@ func parseCmdLine(args []string) (command string, err error) {
func main() {
kingpin.MustParse(parseCmdLine(os.Args[1:]))
var metrics = MetricList{Version: Version}
var connstring = connectionString(*host, *database, *username, *password)
pwd := ""
if *password {
fmt.Print("Enter Password: ")
fmt.Scanln(&pwd)
}
var connstring = connectionString(*host, *database, *username, pwd)
db := connectDB(connstring)
context := &appContext{db, &metrics}
go metricScheduler(db, &metrics, indexBloatUpdate, GetIndexBloatResult, 12*60*60, 120)
Expand Down

0 comments on commit 804786e

Please sign in to comment.