Fix getOpenvpnConfig - error while hitting api/5/openvpn/config
echo: http: panic serving 127.0.0.1:54828: runtime error: index out of range [0] with length 0
goroutine 68138 [running]:
net/http.(*conn).serve.func1()
/usr/lib/go-1.19/src/net/http/server.go:1850 +0xbf
panic({0xf07040, 0xc000360018})
/usr/lib/go-1.19/src/runtime/panic.go:890 +0x262
0xacab.org/leap/menshen/pkg/api.(*registry).getOpenVPNConfig(0xc000199280)
/src/pkg/api/genconfig.go:66 +0x26b
0xacab.org/leap/menshen/pkg/api.(*registry).GenerateConfig(0xc000067758?, {0x194f6f0, 0xc0000010e0})
/src/pkg/api/genconfig.go:24 +0x25
github.com/labstack/echo/v4.(*Echo).add.func1({0x194f6f0, 0xc0000010e0})
/root/go/pkg/mod/github.com/labstack/echo/v4@v4.11.1/echo.go:582 +0x51
github.com/labstack/echo/v4/middleware.LoggerWithConfig.func2.1({0x194f6f0, 0xc0000010e0})
/root/go/pkg/mod/github.com/labstack/echo/v4@v4.11.1/middleware/logger.go:126 +0xe2
0xacab.org/leap/menshen/pkg/api.authTokenMiddleware.func1({0x194f6f0, 0xc0000010e0})
/src/pkg/api/auth.go:38 +0x302
0xacab.org/leap/menshen/pkg/api.storageMiddleware.func1.1({0x194f6f0, 0xc0000010e0})
/src/pkg/api/storage.go:14 +0x5f
github.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc000149680, {0x1941aa0?, 0xc0000a8700}, 0xc0000a6b00)
/root/go/pkg/mod/github.com/labstack/echo/v4@v4.11.1/echo.go:669 +0x3d1
net/http.serverHandler.ServeHTTP({0xc000284f30?}, {0x1941aa0, 0xc0000a8700}, 0xc0000a6b00)
/usr/lib/go-1.19/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc00014c3c0, {0x1942538, 0xc0001bbfb0})
/usr/lib/go-1.19/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
/usr/lib/go-1.19/src/net/http/server.go:3102 +0x4db