Skip to content

Commit

Permalink
Merge pull request #12 from Gandem/oxlay/config-as-flag
Browse files Browse the repository at this point in the history
Load config file using CLI argument
  • Loading branch information
oxlay authored Feb 12, 2018
2 parents 4c0cc7b + d07b70c commit 620c456
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"flag"
"fmt"
"log"
"net"
Expand All @@ -10,11 +11,11 @@ import (
"github.com/google/gopacket/pcap"
)

const configPath = "./config.toml"

func main() {
// Read config file and generate mDNS forwarding maps
cfg, err := readConfig(configPath)
configPath := flag.String("config", "", "Config file in TOML format")
flag.Parse()
cfg, err := readConfig(*configPath)
if err != nil {
log.Fatalf("Could not read configuration: %v", err)
}
Expand Down

0 comments on commit 620c456

Please sign in to comment.