Skip to content

Commit

Permalink
Merge pull request #7 from film42/schinn/add_config_arg
Browse files Browse the repository at this point in the history
add config arg
  • Loading branch information
schinns authored Aug 26, 2020
2 parents 47bdd7b + 0352b41 commit b44ad06
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package main

import (
"encoding/json"
"errors"
"log"
"net/http"
"os"

"github.com/film42/pgreba/config"
"github.com/gorilla/handlers"
Expand Down Expand Up @@ -78,7 +80,12 @@ func (hc *HealthCheckWebService) apiGetIsReplica(w http.ResponseWriter, r *http.
}

func main() {
cfg, err := config.ParseConfig("./examples/config.yml")
if len(os.Args) < 2 {
panic(errors.New("Please provide a path to config yml."))
}
pathToConfig := os.Args[1]

cfg, err := config.ParseConfig(pathToConfig)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit b44ad06

Please sign in to comment.