summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2020-06-03 00:15:46 -0400
committerBen Burwell <ben@benburwell.com>2020-06-03 00:15:46 -0400
commitb80c7640295bb7db57e91461d2aae4d8377f20a6 (patch)
tree1b7a43e186de04a7a0f708ed2a044167dd3c6cb8 /main.go
parentf3e0b43b6b2c8f1a2fee3468100b2d926fad7284 (diff)
Specify the database connection in CLI argsHEADmaster
Diffstat (limited to 'main.go')
-rw-r--r--main.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/main.go b/main.go
index 5639ea4..9088cd4 100644
--- a/main.go
+++ b/main.go
@@ -1,6 +1,7 @@
package main
import (
+ "fmt"
"log"
"os"
@@ -13,7 +14,11 @@ import (
var app = tview.NewApplication()
func main() {
- db, err := postgres.Open("postgres://postgres:password@localhost:5432/postgres?sslmode=disable")
+ if len(os.Args) < 2 {
+ fmt.Fprintf(os.Stderr, "usage: %s <conn>\n", os.Args[0])
+ os.Exit(1)
+ }
+ db, err := postgres.Open(os.Args[1])
if err != nil {
log.Printf("could not connect to db: %v", err)
os.Exit(1)