|
@@ -77,8 +77,8 @@ func init() {
|
|
Config = new(ConfigT)
|
|
Config = new(ConfigT)
|
|
}
|
|
}
|
|
|
|
|
|
-// Load loads the config file placed at the given path.
|
|
|
|
-func Load(path string, config *ConfigT) error {
|
|
|
|
|
|
+// ReadFile reads the config file placed at the given path.
|
|
|
|
+func ReadFile(path string, config *ConfigT) error {
|
|
cf, err := ioutil.ReadFile(path)
|
|
cf, err := ioutil.ReadFile(path)
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
@@ -88,3 +88,11 @@ func Load(path string, config *ConfigT) error {
|
|
}
|
|
}
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// Read reads the config data from the given slice.
|
|
|
|
+func Read(data []byte, config *ConfigT) error {
|
|
|
|
+ if err := yaml.Unmarshal(data, config); err != nil {
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ return nil
|
|
|
|
+}
|