-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Obviously, safe --target <x> target doesn't make a lot of sense on its own, but there are conditions where it does make sense.
The most crucial is when the safe target is being specified by the SAFE_TARGET environment variable. In this case, safe outright lies to you when you run safe target because internally, there is no difference between overriding the target with --target or by use of the environment variable.
The scenario:
$ export SAFE_TARGET=prod
...some time later...
$ safe target sandbox
$ safe target
Specifying --target to the target command makes no sense; ignoring...
Currently targeting sandbox at https://10.10.0.4
Skipping TLS certificate validation
Uses Strongbox at http://10.10.0.4:8484/strongbox
$ safe rm -rf secret/*
# Oh-noes - prod secrets all gone!
In this case, safe target should return whatever target will be used when safe is called in that environment.
Similarly, when running safe target --json in order to get the current target information in a json format, safe currently gives the .saferc 'current' target details, not the target in that environment. It even makes more sense to support the explicit --target <x> option in this case for when you want to read details about a specific target without changing the actual target.