v 1.0.0 - Added functionnal testing - Needs Travis integration

This commit is contained in:
Brendan LE GLAUNEC
2016-06-21 10:53:24 +02:00
parent 08231074b9
commit 1f5e9fc502
24 changed files with 1138 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
package main
import (
"encoding/json"
"fmt"
"os"
)
func (m *manager) parseConfig() bool {
// Get config file path
confPath := "conf/cameratest.conf.json"
av := len(os.Args)
if av == 2 {
confPath = os.Args[1]
}
// Load config
fmt.Printf("Loading config file: %s ... ", confPath)
configFile, err := os.Open(confPath)
if err != nil {
fmt.Printf("\nCan't open config file: %s\n", err)
return false
}
dec := json.NewDecoder(configFile)
if err = dec.Decode(&m); err != nil {
fmt.Printf("\nUnable to deserialize config file: %s\n", err)
return false
}
fmt.Println("Configuration file successfully loaded\n")
return true
}