diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2018-12-28 18:57:07 -0500 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2018-12-28 18:57:07 -0500 |
| commit | 33389b0719c78de5fc5694a173f951b3666c183b (patch) | |
| tree | 57a3f2574d9173812d09b874aebcfd73a7358679 /main.go | |
| parent | 04cf96cdc3ef6c78b2d4754e3c8028b5c1c45fc0 (diff) | |
| download | id-33389b0719c78de5fc5694a173f951b3666c183b.tar.gz | |
Read database address from command line args
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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) |
