@@ -236,16 +236,29 @@ func validateCertParams(cert NewCertParams) map[string]map[string]string {
236
236
func (c * CertificatesController ) saveClientConfig (keysPath string , name string ) (string , error ) {
237
237
cfg := clientconfig .New ()
238
238
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
249
262
250
263
ca , err := os .ReadFile (filepath .Join (keysPathCa , "ca.crt" ))
251
264
if err != nil {
0 commit comments