devops-rob / target-cli

A CLI tool to manage context profiles for HashiCorp tools
Apache License 2.0
32 stars 5 forks source link

The `bounary select` subcommand sets a Nomad token #17

Closed picatz closed 9 months ago

picatz commented 9 months ago

The selectBoundaryCmd sets a NOMAD_TOKEN environment variable:

https://github.com/devops-rob/target-cli/blob/7a10f70ca7b6f6da387f82a00136414b66ff0ba4/cmd/select.go#L400-L405

picatz commented 9 months ago

FWIW, additionally, the logic could be simplified to:

 if context.Token != "" { 
    // TODO - Double check if this is needed 
    exportCommandStr = append(exportCommandStr, fmt.Sprintf("export BOUNDARY_TOKEN=%s", context.Token)) 
 } 

Instead of using the (temporary) shellCommandToken variable, which is only ever used in that small section. This pattern is used several times in the various product subcommands, but could be simplified quite a bit, and avoid unnecessary string allocations.