aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2018-12-28 18:57:07 -0500
committerThibaut Horel <thibaut.horel@gmail.com>2018-12-28 18:57:07 -0500
commit33389b0719c78de5fc5694a173f951b3666c183b (patch)
tree57a3f2574d9173812d09b874aebcfd73a7358679 /main.go
parent04cf96cdc3ef6c78b2d4754e3c8028b5c1c45fc0 (diff)
downloadid-33389b0719c78de5fc5694a173f951b3666c183b.tar.gz
Read database address from command line args
Diffstat (limited to 'main.go')
-rw-r--r--main.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.go b/main.go
index 998791a..a8afe72 100644
--- a/main.go
+++ b/main.go
@@ -7,6 +7,7 @@ import (
"html/template"
"log"
"net/http"
+ "os"
"strconv"
"time"
)
@@ -67,7 +68,10 @@ func (app *App) loginHandler(w http.ResponseWriter, r *http.Request) {
func main() {
//log.SetFlags(log.LstdFlags)
- store := NewPgStore()
+ if len(os.Args) == 1 {
+ log.Fatalf("Usage: %s <connect-string>\n", os.Args[0])
+ }
+ store := NewPgStore(os.Args[1])
template := template.Must(template.New("").ParseGlob("templates/*.tmpl"))
app := &App{store, template}
http.HandleFunc("/validate", app.validateHandler)