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 agoHello @"Justin.Yoon_1P" .
Thank you for getting back to me.
Small context about the secret: is it used to access an account on https://airflow.apache.org/, which is kind of a task orchestrator.
The output of the echo $AIRFLOW_SERVICE_ACCOUNT
command is the following:
null
{
"type": "service_account",
"project_id": "bla",
"private_key_id": "bla",
"private_key": "-----BEGIN PRIVATE KEY-----
bla
-----END PRIVATE KEY-----
",
"client_email": "bla",
"client_id": "bla",
"auth_uri": "bla",
"token_uri": "bla",
"auth_provider_x509_cert_url": "bla",
"client_x509_cert_url": "bla"
}
which I believe is the same as calling the op command as per my 1st message.
when I run the following command op item get --cache --format=json [gcp location]
this is the entire dict:
{
"id": "bla",
"title": "bla",
"version": 1,
"vault": {
"id": "bla",
"name": "Engineering"
},
"category": "SECURE_NOTE",
"last_edited_by": "bla",
"created_at": "bla",
"updated_at": "bla",
"fields": [
{
"id": "notesPlain",
"type": "STRING",
"purpose": "NOTES",
"label": "notesPlain"
},
{
"id": "secret",
"type": "CONCEALED",
"label": "secret",
"value": "{\n\"type\": \"service_account\",\n \"project_id\": \"bla\",\n \"private_key_id\": \"bla\",\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nbla\\n-----END PRIVATE KEY-----\\n\",\n \"client_email\": \"bla\",\n \"client_id\": \"bla\",\n \"auth_uri\": \"bla\",\n \"token_uri\": \"bla\",\n \"auth_provider_x509_cert_url\": \"bla\",\n \"client_x509_cert_url\": \"bla\"\n}"
}
]
}
and the part that I am trying to isolate is the entire value inside the key 'value' near the end.