summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tcpip')
-rw-r--r--pkg/tcpip/config/config.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/pkg/tcpip/config/config.go b/pkg/tcpip/config/config.go
index c3518ef35..d021bf6a3 100644
--- a/pkg/tcpip/config/config.go
+++ b/pkg/tcpip/config/config.go
@@ -118,14 +118,9 @@ type Config struct {
routes []tcpip.Route
}
-func Load(yamlname string) (*Config, error) {
- data, err := ioutil.ReadFile(yamlname)
- if err != nil {
- log.Fatalf("File reading error", err)
- }
-
+func LoadFromBytes(data []byte) (*Config, error) {
var np Netplan
- err = yaml.Unmarshal(data, &np)
+ err := yaml.Unmarshal(data, &np)
fmt.Println("err", err)
fmt.Println("res", np)
@@ -139,6 +134,15 @@ func Load(yamlname string) (*Config, error) {
}, nil
}
+func Load(yamlname string) (*Config, error) {
+ data, err := ioutil.ReadFile(yamlname)
+ if err != nil {
+ log.Fatalf("File reading error", err)
+ }
+
+ return LoadFromBytes(data)
+}
+
func CheckError(err error) {
if err != nil {
log.Fatal("Error: " , err)