2015-02-17 05:08:48 +00:00
|
|
|
package config
|
|
|
|
|
2015-07-29 06:52:15 +00:00
|
|
|
func NewConfig() *CloudConfig {
|
2015-08-20 14:20:51 +00:00
|
|
|
return ReadConfig(nil, OsConfigFile)
|
2015-06-15 20:58:16 +00:00
|
|
|
}
|
|
|
|
|
2015-08-20 14:20:51 +00:00
|
|
|
func ReadConfig(bytes []byte, files ...string) *CloudConfig {
|
|
|
|
if data, err := readConfig(bytes, files...); err == nil {
|
2015-07-29 06:52:15 +00:00
|
|
|
c := &CloudConfig{}
|
2015-08-20 14:20:51 +00:00
|
|
|
if err := c.merge(data); err != nil {
|
|
|
|
return nil
|
|
|
|
}
|
2015-07-29 06:52:15 +00:00
|
|
|
c.amendNils()
|
2015-06-15 20:58:16 +00:00
|
|
|
return c
|
|
|
|
} else {
|
|
|
|
return nil
|
2015-02-17 05:08:48 +00:00
|
|
|
}
|
|
|
|
}
|