|
|
@@ -24,15 +24,15 @@ func main() {
|
|
|
}
|
|
|
}()
|
|
|
var err error
|
|
|
+ configFile := "config.json"
|
|
|
|
|
|
- // Processing template
|
|
|
- tmpl, err = template.New("index").Parse(index)
|
|
|
- if err != nil {
|
|
|
- panic(err)
|
|
|
+ // Reading configuration
|
|
|
+ if len(os.Args) >= 2 {
|
|
|
+ configFile = os.Args[1]
|
|
|
}
|
|
|
|
|
|
- // Reading configuration
|
|
|
- logFile, err := ioutil.ReadFile("config.json")
|
|
|
+ log.Println("Reading config", configFile)
|
|
|
+ logFile, err := ioutil.ReadFile(configFile)
|
|
|
if err != nil {
|
|
|
panic(err)
|
|
|
}
|
|
|
@@ -41,6 +41,12 @@ func main() {
|
|
|
panic(err)
|
|
|
}
|
|
|
|
|
|
+ // Processing template
|
|
|
+ tmpl, err = template.New("index").Parse(index)
|
|
|
+ if err != nil {
|
|
|
+ panic(err)
|
|
|
+ }
|
|
|
+
|
|
|
// Serving HTTP
|
|
|
http.HandleFunc("/", router)
|
|
|
|