Getting started with 1Password for your growing team, or refining your setup? Our Secured Success quickstart guide is for you.
Forum Discussion
Former Member
4 years agoexport specific secret value as an environment variable
Hello 1Password Community :)
I am trying to fetch and export a specific secret value as an environment variable:
what I tried: - Note that I replaced the actual gcp location with [gcp location]...
Former Member
4 years agoHey @Nadros ,
It looks like you are saving a JSON object directly as a value in 1Password. At first glance, it seems like your code is having trouble parsing the JSON. Could you print what echo $AIRFLOW_SERVICE_ACCOUNT
returns for you after you set that var (with the info redacted with "bla" of course)? I would like to see if there are any strings that we add for formatting that may break in your code.
Additionally, I do think there may be an alternative - to set each key:value in the JSON as its own field in the item.
If you take this approach, each of the values can be accessed by our https://developer.1password.com/docs/cli/secrets-environment-variables syntax, which in conjunction with our op run
command to start your app, can load distinct env vars for use during runtime.