30 lines
493 B
Go
30 lines
493 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"fmt"
|
||
|
"github.com/dballard/warren/lib/warren"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
type Conf struct {
|
||
|
deployments []string
|
||
|
}
|
||
|
|
||
|
var conf *Conf = nil
|
||
|
|
||
|
func LoadConf() {
|
||
|
file, err := os.Open(warren.WarrendConf)
|
||
|
if err != nil {
|
||
|
fmt.Println("Error loading ", warren.WarrendConf, ": ", err)
|
||
|
return
|
||
|
}
|
||
|
decoder := json.NewDecoder(file)
|
||
|
conf = new(Conf)
|
||
|
err = decoder.Decode(conf)
|
||
|
if err != nil {
|
||
|
conf = nil
|
||
|
fmt.Println("Error parsing ", warren.WarrendConf, ": ", err)
|
||
|
}
|
||
|
}
|