Is there a CLI which you can use with the Connect Server API?

Hello there,

I was wondering, 1PW has this nice op CLI (now in v2) with a lot of features to inject environment variables and such.
I think this feature is mostly needed in contexts which use config files and environment variables a lot: automated pipelines and servers...
And exactly there one should use the Connect Server Pattern instead of directly accessing 1PW, right?

So, is there a way to use these features or this CLI with a Connect Server?
Or is there any CLI available so one can use the Connect Server API in an imperative way?

(I'm currently rewriting an op based script to use the Connect Server API, but it feels very weird to replace every small op ... call with a large curl block.)

Kind regards,
Malte


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided

Comments

  • eddy_1Peddy_1P

    Team Member
    edited May 4

    Hey @nottmeyprotofy,

    There is a way to make the CLI fetch secrets using Connect. All you need to do is set up two environment variables:

    • OP_CONNECT_HOST - the path to your Connect server
    • OP_CONNECT_TOKEN - the authorisation token that you want to use to get the secrets from Connect.

    Once these two environment variables are set, the following commands of the CLI will get secrets with Connect:

    • op read
    • op run
    • op inject
    • op item get --format json (you need to mention the JSON format as an output, since Connect only works with JSON output)

    More details can be found in the following pages in the 1Password Developer Documentation:

    Let me know if you have any other questions. I'm more than happy to help.

  • nottmeyprotofynottmeyprotofy
    Community Member

    Hey @eddy_1P,

    Oh, thank you for the hint, I must have missed this while reading the docs!

    How about the other standard commands like

    • op document list
    • op document get
    • op item edit
    • op document create (I guess this one is not supported, because uploading is not a feature?)

    Are they also possible/supported?

    Best,
    Malte

  • eddy_1Peddy_1P

    Team Member

    Hey @nottmeyprotofy,

    The list of commands that you mentioned are currently not supported when the CLI is set to use Connect.

    However, for the first two (and I'd also think about op item list), I'd find it useful to be able to do those with Connect as well.

    op item edit with Connect is an interesting use case to explore. This makes me also think about using op item create with Connect.

    As for op document create, like you mentioned, it's currently not supported with Connect because we currently don't have an API endpoint for uploading files.

    I will raise the idea of enabling Connect for the commands you mentioned with the team responsible for the CLI and we will get back to you when we have an update on this.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file