config.json path can now be specified with the --config flag

This commit is contained in:
Sean DuBois 2014-07-07 20:30:11 +00:00
parent a49b9b67de
commit f3fe29f69b

View file

@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"flag"
"fmt"
"github.com/Sean-Der/fail2go"
"github.com/gorilla/mux"
@ -21,7 +22,10 @@ type ErrorBody struct {
var fail2goConn *fail2go.Conn
func main() {
file, fileErr := os.Open("config.json")
configPath := flag.String("config", "config.json", "path to config.json")
flag.Parse()
file, fileErr := os.Open(*configPath)
if fileErr != nil {
fmt.Println("failed to open config:", fileErr)