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