Add -config flag
This commit is contained in:
parent
9aefd1937d
commit
f64eb89cee
8
main.go
8
main.go
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
@ -8,8 +9,13 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var configPath = "config"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cfg, err := Load("config")
|
flag.StringVar(&configPath, "config", configPath, "path to configuration file")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
cfg, err := Load(configPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to load config file: %v", err)
|
log.Fatalf("failed to load config file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue