Skip to content

Commit 665756d

Browse files
committed
bugfix for issue #30
1 parent aa60ba9 commit 665756d

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

controllers/certificates.go

+23-10
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,29 @@ func validateCertParams(cert NewCertParams) map[string]map[string]string {
236236
func (c *CertificatesController) saveClientConfig(keysPath string, name string) (string, error) {
237237
cfg := clientconfig.New()
238238
keysPathCa := filepath.Join(state.GlobalCfg.OVConfigPath, "pki")
239-
ServerAddress := models.OVClientConfig{Profile: "default"}
240-
_ = ServerAddress.Read("Profile")
241-
cfg.ServerAddress = ServerAddress.ServerAddress
242-
OpenVpnServerPort := models.OVClientConfig{Profile: "default"}
243-
_ = OpenVpnServerPort.Read("Profile")
244-
cfg.OpenVpnServerPort = OpenVpnServerPort.OpenVpnServerPort
245-
246-
AuthUserPass := models.OVClientConfig{Profile: "default"}
247-
_ = AuthUserPass.Read("Profile")
248-
cfg.AuthUserPass = AuthUserPass.AuthUserPass
239+
240+
ovClientConfig := &models.OVClientConfig{Profile: "default"}
241+
if err := ovClientConfig.Read("Profile"); err != nil {
242+
return "", err
243+
}
244+
cfg.ServerAddress = ovClientConfig.ServerAddress
245+
cfg.OpenVpnServerPort = ovClientConfig.OpenVpnServerPort
246+
cfg.AuthUserPass = ovClientConfig.AuthUserPass
247+
cfg.ResolveRetry = ovClientConfig.ResolveRetry
248+
cfg.OVClientUser = ovClientConfig.OVClientUser
249+
cfg.OVClientGroup = ovClientConfig.OVClientGroup
250+
cfg.PersistTun = ovClientConfig.PersistTun
251+
cfg.PersistKey = ovClientConfig.PersistKey
252+
cfg.RemoteCertTLS = ovClientConfig.RemoteCertTLS
253+
cfg.RedirectGateway = ovClientConfig.RedirectGateway
254+
// cfg.Proto = ovClientConfig.Proto // this will be set from server config
255+
cfg.Device = ovClientConfig.Device
256+
cfg.AuthNoCache = ovClientConfig.AuthNoCache
257+
cfg.TlsClient = ovClientConfig.TlsClient
258+
cfg.Verbose = ovClientConfig.Verbose
259+
cfg.CustomConfOne = ovClientConfig.CustomConfOne
260+
cfg.CustomConfTwo = ovClientConfig.CustomConfTwo
261+
cfg.CustomConfThree = ovClientConfig.CustomConfThree
249262

250263
ca, err := os.ReadFile(filepath.Join(keysPathCa, "ca.crt"))
251264
if err != nil {

0 commit comments

Comments
 (0)