Forum Discussion

Former Member's avatar
Former Member
4 years ago

[49] Provide a way to set global flags using environment variables

It would be helpful it the global options such as --account, --iso-timestamps, --format, --session, etc were configurable via environment variables
(for example, OP_ACCOUNT_ID, OP_FORMAT, OP_SESSION_TOKEN, etc) rather than just being configurable using command line flags. This way scripts don't have to provide a particular set of flags for every command that needs to be run with a specific global configuration.


1Password Version: 2.0.0-beta.9
Extension Version: Not Provided
OS Version: macOS 12.0.1 21A559 arm64

4 Replies

  • Former Member's avatar
    Former Member

    Good news, the OP_ISO_TIMESTAMPS flags has made it into our latest release!
    I have opened a ticket for the --cache flag too, and it is currently on the roadmap.

  • Former Member's avatar
    Former Member

    Maybe one for the --cache, too?

  • Former Member's avatar
    Former Member

    Hey both!
    Thank you for your suggestions. Indeed, having a set of environment variables to replace the most used flags can be really helpful. We already have support, as far as I know, for OP_SESSION_<shorthand>, OP_FORMAT and OP_ACCOUNT. OP_ACCOUNT, however, is documented nowhere, so I'm going to open up a ticket for that.
    Do you have any other flags that you would like to see with an option to be set via environment variables?
    I'm going to also open a ticket for the --iso-timestamps flag, for now, and we can add to that as new ideas arise.
    Thank you for giving CLI 2.0 a go, and please keep the good feedback coming!

    Best,
    Horia

  • Former Member's avatar
    Former Member

    :+1: from me!

    But as far as I understand, the session tokens are already read from an environment variable (which op signin outputs, and you normally eval into shell session). I.e. OP_SESSION_<account>.