Configuration filename is now an option
This commit is contained in:
parent
b99a321ded
commit
a375c6d2b1
3
main.go
3
main.go
@ -69,6 +69,7 @@ func StripPrefix(prefix string, h http.Handler) http.Handler {
|
||||
func main() {
|
||||
var bind = flag.String("bind", "127.0.0.1:8080", "Bind port/socket")
|
||||
var baseURL = flag.String("baseurl", "/", "URL prepended to each URL")
|
||||
var configfile = flag.String("config", "config.json", "path to the configuration file")
|
||||
flag.StringVar(&StaticDir, "static", StaticDir, "Directory containing static files")
|
||||
flag.Parse()
|
||||
|
||||
@ -87,7 +88,7 @@ func main() {
|
||||
}
|
||||
|
||||
// Load config file
|
||||
if fd, err := os.Open("config.json"); err != nil {
|
||||
if fd, err := os.Open(*configfile); err != nil {
|
||||
log.Fatal(err)
|
||||
} else if cnt, err := ioutil.ReadAll(fd); err != nil {
|
||||
log.Fatal(err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user