notation icon indicating copy to clipboard operation
notation copied to clipboard

Allow configuration dir to be overridden

Open jeremyrickard opened this issue 2 years ago • 13 comments

What is the areas you would like to add the new feature to?

Notation CLI

Is your feature request related to a problem?

Currently, the notation CLI defaults to using os.UserConfigDir from notation-go dir/path via cmd/notation/verify.go and notation-go verifier/trustpolicy/trustpolicy.go

On MacOS, this ends up being $HOME/Library/Application Support which isn't extremely obvious and is super varied based on system:

// On Unix systems, it returns $XDG_CONFIG_HOME as specified by
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if
// non-empty, else $HOME/.config.
// On Darwin, it returns $HOME/Library/Application Support.
// On Windows, it returns %AppData%.
// On Plan 9, it returns $home/lib.

What solution do you propose?

It would be nice if this value could be overridden with an environment variable, so a user could support multiple configurations (as with docker or kubectl) or could more easily store things in their home directory (os.UserHomeDir) on non linux based operating systems.

What alternatives have you considered?

There could be multiple other avenues for this but an environment variable seems the most flexible.

Some alternatives could be:

  1. A new configuration flag. This would be extremely cumbersome from a user experience stand point.
  2. Changing the value to use os.UserHomeDir instead. This wouldn't provide flexibility and would not incorporate the original reason for using os.UserConfigDir

Any additional context?

No response

jeremyrickard avatar Dec 07 '22 04:12 jeremyrickard