Skip to main content
December 10, 2021
Question

[26] Dotenv from file broke in 2.0x

  • December 10, 2021
  • 4 replies
  • 82 views

I've tried following this exactly on a few builds in 2.0x but it seems it's broke:

https://developer.1password.com/docs/cli/guides/environment-variables/#option-2-env-dotenv-file

[ERROR] 2021/12/10 17:20:40 Can't separate key from value

I've tried various ways and confirmed it's meeting the syntax rules.

$ op --version 2.0.0-beta.7

Could someone else verify as well?


1Password Version: 2.0.0-beta.7
Extension Version: Not Provided
OS Version: macOS 12.0.1

4 replies

December 13, 2021

Hey @chrisgoffinet

I would be happy to offer some assistance.

I've just tested using the .env file as per the examples:

```

pre-req: a Database item titled "mysql" in a vault called "prod" with the database, username, and password fields filled out

create .env file and add the 3 secrets to it from the example

touch .env
echo "MYSQL_DATABASE = op://prod/mysql/database" >> .env
echo "MYSQL_USERNAME = op://prod/mysql/username" >> .env
echo "MYSQL_PASSWORD = op://prod/mysql/password" >> .env

run op run to see if it can print the secrets

op run --dotenv --no-masking -- printenv MYSQL_DATABASE
```

And it is working correctly for me on the beta-7 version.

Could you provide an example similar to one of the lines in your .env file?

December 14, 2021

@chrisgoffinet Hello 👋 - the CLI 2.0 beta is still in closed access right now so we've moved your thread over to this private forum and given you access. Justin replied here so I just wanted to make sure you saw his reply!

December 14, 2021

thank you @ag_tyler

@"Justin.Yoon_1P"

I was able to reproduce this issue, after running your steps. I still got the error and suspected it must somehow be tied to my bash environment. Long and behold it was after unsetting certain vars. The one in question was PROMPT_COMMAND

PROMPT_COMMAND=_direnv_hook;_kube_ps1_update_cache;history -a; history -n; history -a; history -n;

Looks like when op traverses the environment variables, thats what it was getting caught on. I suspect this is the bug that should be looked into.

December 16, 2021

Thank you for reporting the bug, @chrisgoffinet

I will file it in our internal issue tracker.