applyFlagsToConfig applies command line flags to the config object
(cfg *config.Config, opts BootstrapOptions)
| 404 | |
| 405 | // applyFlagsToConfig applies command line flags to the config object |
| 406 | func applyFlagsToConfig(cfg *config.Config, opts BootstrapOptions) { |
| 407 | // Apply flag values to config if they were set |
| 408 | if opts.FlagAddr != "" { |
| 409 | cfg.Addr = opts.FlagAddr |
| 410 | } |
| 411 | if opts.FlagUser != "" { |
| 412 | cfg.User = opts.FlagUser |
| 413 | } |
| 414 | if opts.FlagPassword != "" { |
| 415 | cfg.Password = opts.FlagPassword |
| 416 | } |
| 417 | if opts.FlagTokenID != "" { |
| 418 | cfg.TokenID = opts.FlagTokenID |
| 419 | } |
| 420 | if opts.FlagTokenSecret != "" { |
| 421 | cfg.TokenSecret = opts.FlagTokenSecret |
| 422 | } |
| 423 | if opts.FlagRealm != "" { |
| 424 | cfg.Realm = opts.FlagRealm |
| 425 | } |
| 426 | if opts.FlagInsecure { |
| 427 | cfg.Insecure = true |
| 428 | } |
| 429 | if opts.FlagApiPath != "" { |
| 430 | cfg.ApiPath = opts.FlagApiPath |
| 431 | } |
| 432 | if opts.FlagSSHUser != "" { |
| 433 | cfg.SSHUser = opts.FlagSSHUser |
| 434 | } |
| 435 | if opts.FlagVMSSHUser != "" { |
| 436 | cfg.VMSSHUser = opts.FlagVMSSHUser |
| 437 | } |
| 438 | if opts.FlagSSHKeyfile != "" { |
| 439 | cfg.SSHKeyfile = opts.FlagSSHKeyfile |
| 440 | } |
| 441 | if opts.FlagVMSSHKeyfile != "" { |
| 442 | cfg.VMSSHKeyfile = opts.FlagVMSSHKeyfile |
| 443 | } |
| 444 | if opts.FlagSSHJumpHostAddr != "" { |
| 445 | cfg.SSHJumpHost.Addr = opts.FlagSSHJumpHostAddr |
| 446 | } |
| 447 | if opts.FlagSSHJumpHostUser != "" { |
| 448 | cfg.SSHJumpHost.User = opts.FlagSSHJumpHostUser |
| 449 | } |
| 450 | if opts.FlagSSHJumpHostKeyfile != "" { |
| 451 | cfg.SSHJumpHost.Keyfile = opts.FlagSSHJumpHostKeyfile |
| 452 | } |
| 453 | if opts.FlagSSHJumpHostPort > 0 { |
| 454 | cfg.SSHJumpHost.Port = opts.FlagSSHJumpHostPort |
| 455 | } |
| 456 | if opts.FlagDebug { |
| 457 | cfg.Debug = true |
| 458 | } |
| 459 | if opts.FlagCacheDir != "" { |
| 460 | cfg.CacheDir = config.ExpandHomePath(opts.FlagCacheDir) |
| 461 | } |
| 462 | if opts.FlagAgeDir != "" { |
| 463 | expandedAgeDir := config.ExpandHomePath(opts.FlagAgeDir) |
no test coverage detected