Skip to content

Commit 041964d

Browse files
committed
bugfix: if no route is set, define an empty default route
1 parent 2ffe548 commit 041964d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/utils/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
var (
2424
defaultSSHExe = "ssh"
2525
defaultSSHArgs = []string{"-q", "-Y"}
26+
defaultRoutes = map[string]*RouteConfig{"default": &RouteConfig{
27+
Dest: []string{}}}
2628
)
2729

2830
// Config represents the configuration for sshproxy.
@@ -219,6 +221,10 @@ func LoadConfig(filename, currentUsername, sid string, start time.Time, groups m
219221
config.SSH.Args = defaultSSHArgs
220222
}
221223

224+
if config.Routes == nil {
225+
config.Routes = defaultRoutes
226+
}
227+
222228
// we have to use a slice of maps in order to have ordered maps
223229
for _, groupconfigs := range config.Groups {
224230
for groupnames, groupconfig := range groupconfigs {

0 commit comments

Comments
 (0)