Commit 04162aaa authored by Matthew Holt's avatar Matthew Holt

Added flag to specify config file location

parent db1adcac
package main
import (
"flag"
"log"
"sync"
......@@ -11,7 +12,9 @@ import (
func main() {
var wg sync.WaitGroup
vhosts, err := config.Load("Caddyfile")
flag.Parse()
vhosts, err := config.Load(conf)
if err != nil {
if config.IsNotFound(err) {
vhosts = config.Default()
......@@ -37,3 +40,9 @@ func main() {
wg.Wait()
}
func init() {
flag.StringVar(&conf, "conf", server.DefaultConfigFile, "the configuration file to use")
}
var conf string
......@@ -174,3 +174,5 @@ func enableLogging(l config.Log) (*log.Logger, error) {
return log.New(file, "", 0), nil
}
const DefaultConfigFile = "Caddyfile"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment