is env variable referencing supported?

Options
tslade
tslade
Community Member
edited October 2023 in CLI

Hi,

Hoping someone can help answer my question...

In my NodeJS project, I use the 1Password cli to load my secrets into my env file using the 'op run' command. e.g.
op run --env-file="./.env.local" -- npm start

In my .env.local file, i'm attempting to reference an environment variable where the value is being fetched from my 1Password vault. Example env file below:

VITE_SITE_LINK="op://example/dev/site-url"
VITE_SITE_PRIVACY_LINK=${VITE_SITE_LINK}/privacy-policy

However, I'm getting the following error:
[ERROR] 2023/10/17 15:11:22 item example/5pviavnxgs7lqeimhzeu73blje does not have a field VITE_SITE_LINK.privacy-policy


1Password Version: 8.10.16
Extension Version: Not Provided
OS Version: macOS 13.5.2
Browser: Not Provided
1Password CLI Version: 2.21.0

Comments

  • philmcole
    philmcole
    Community Member
    edited December 2023
    Options

    Same here. I'd like to define the secret reference as part of some string in the .env file.

    .env file

    GITHUB_TOKEN="op://foo/bar/token"
    DENO_AUTH_TOKENS="${GITHUB_TOKEN}@raw.githubusercontent.com"
    

    error

    [ERROR] 2023/12/22 12:57:07 invalid secret reference 'op://foo/bar/token@raw.githubusercontent.com': invalid character in secret reference: '@'