This commit is contained in:
oliver 2015-07-31 23:29:22 +00:00
commit beef96a972

View file

@ -126,24 +126,24 @@ func marshallConfigReader(in io.Reader, c map[string]interface{}, configType str
switch strings.ToLower(configType) { switch strings.ToLower(configType) {
case "yaml", "yml": case "yaml", "yml":
if err := yaml.Unmarshal(buf.Bytes(), &c); err != nil { if err := yaml.Unmarshal(buf.Bytes(), &c); err != nil {
jww.ERROR.Fatalf("Error parsing config: %s", err) jww.ERROR.Panicf("Error parsing config: %s", err)
} }
case "json": case "json":
if err := json.Unmarshal(buf.Bytes(), &c); err != nil { if err := json.Unmarshal(buf.Bytes(), &c); err != nil {
jww.ERROR.Fatalf("Error parsing config: %s", err) jww.ERROR.Panicf("Error parsing config: %s", err)
} }
case "toml": case "toml":
if _, err := toml.Decode(buf.String(), &c); err != nil { if _, err := toml.Decode(buf.String(), &c); err != nil {
jww.ERROR.Fatalf("Error parsing config: %s", err) jww.ERROR.Panicf("Error parsing config: %s", err)
} }
case "properties", "props", "prop": case "properties", "props", "prop":
var p *properties.Properties var p *properties.Properties
var err error var err error
if p, err = properties.Load(buf.Bytes(), properties.UTF8); err != nil { if p, err = properties.Load(buf.Bytes(), properties.UTF8); err != nil {
jww.ERROR.Fatalf("Error parsing config: %s", err) jww.ERROR.Panicf("Error parsing config: %s", err)
} }
for _, key := range p.Keys() { for _, key := range p.Keys() {
value, _ := p.Get(key) value, _ := p.Get(key)