allow set config file path
This commit is contained in:
parent
d70b774326
commit
601994a372
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
@ -36,8 +37,11 @@ type IpJson struct {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
configPath := "./config.json"
|
configPath := flag.String("config", "./config.json", "path to config file")
|
||||||
configJson, err := ioutil.ReadFile(configPath)
|
flag.Parse()
|
||||||
|
fmt.Println(*configPath)
|
||||||
|
|
||||||
|
configJson, err := ioutil.ReadFile(*configPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err.Error())
|
log.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user