@@ -273,6 +273,13 @@ func ModGlobalConfig(cfg models.IntClient) error{
273273 if cfg .ServerKey != "" {
274274 modconfig .Client .ServerKey = cfg .ServerKey
275275 }
276+ if cfg .AccessKey != "" {
277+ modconfig .Client .AccessKey = cfg .AccessKey
278+ }
279+ if cfg .ClientID != "" {
280+ modconfig .Client .ClientID = cfg .ClientID
281+ }
282+
276283 err = WriteGlobal (& modconfig )
277284 return err
278285}
@@ -369,13 +376,14 @@ func GetCLIConfig(c *cli.Context) (ClientConfig, error){
369376 }
370377 token := string (tokenbytes )
371378 tokenvals := strings .Split (token , "|" )
372- cfg .Server .GRPCAddress = tokenvals [1 ]
373- cfg .Server .APIAddress = tokenvals [2 ]
374- cfg .Network = tokenvals [3 ]
375- cfg .Node .Network = tokenvals [4 ]
376- cfg .Server .AccessKey = tokenvals [5 ]
377- cfg .Node .LocalRange = tokenvals [6 ]
378379
380+ cfg .Server .GRPCAddress = tokenvals [1 ]
381+ cfg .Network = tokenvals [3 ]
382+ cfg .Node .Network = tokenvals [3 ]
383+ cfg .Server .AccessKey = tokenvals [4 ]
384+ if len (tokenvals ) > 5 {
385+ cfg .Node .LocalRange = tokenvals [5 ]
386+ }
379387 if c .String ("grpcserver" ) != "" {
380388 cfg .Server .GRPCAddress = c .String ("grpcserver" )
381389 }
@@ -405,22 +413,22 @@ func GetCLIConfig(c *cli.Context) (ClientConfig, error){
405413 cfg .Node .Password = c .String ("password" )
406414 cfg .Node .MacAddress = c .String ("macaddress" )
407415 cfg .Node .LocalAddress = c .String ("localaddress" )
408- cfg .Node .LocalRange = c .String ("localrange" )
409416 cfg .Node .WGAddress = c .String ("address" )
410417 cfg .Node .WGAddress6 = c .String ("addressIPV6" )
411- cfg .Node .Roaming = c .String ("" )
412- cfg .Node .DNS = c .String ("" )
413- cfg .Node .IsLocal = c .String ("" )
414- cfg .Node .IsDualStack = c .String ("" )
415- cfg .Node .IsIngressGateway = c .String ("" )
416- cfg .Node .PostUp = c .String ("" )
417- cfg .Node .PostDown = c .String ("" )
418- cfg .Node .Port = int32 (c .Int ("" ))
419- cfg .Node .KeepAlive = int32 (c .Int ("" ))
420- cfg .Node .PublicKey = c .String ("" )
421- cfg .Node .PrivateKey = c .String ("" )
422- cfg .Node .Endpoint = c .String ("" )
423- cfg .Node .IPForwarding = c .String ("" )
418+ cfg .Node .Roaming = c .String ("roaming" )
419+ cfg .Node .DNS = c .String ("dns" )
420+ cfg .Node .IsLocal = c .String ("islocal" )
421+ cfg .Node .IsDualStack = c .String ("isdualstack" )
422+ cfg .Node .PostUp = c .String ("postup" )
423+ cfg .Node .PostDown = c .String ("postdown" )
424+ cfg .Node .Port = int32 (c .Int ("port" ))
425+ cfg .Node .KeepAlive = int32 (c .Int ("keepalive" ))
426+ cfg .Node .PublicKey = c .String ("publickey" )
427+ cfg .Node .PrivateKey = c .String ("privatekey" )
428+ cfg .Node .Endpoint = c .String ("endpoint" )
429+ cfg .Node .IPForwarding = c .String ("ipforwarding" )
430+ cfg .OperatingSystem = c .String ("operatingsystem" )
431+ cfg .Daemon = c .String ("daemon" )
424432
425433 return cfg , nil
426434}
@@ -531,4 +539,3 @@ func FileExists(f string) bool {
531539 }
532540 return ! info .IsDir ()
533541}
534-
0 commit comments