Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native .env file support? #418

Closed
mattwaler opened this issue Sep 13, 2019 · 11 comments
Closed

Native .env file support? #418

mattwaler opened this issue Sep 13, 2019 · 11 comments

Comments

@mattwaler
Copy link

I'm using .env files to do all of my secret hiding. It kinda stinks to have to translate the values to JSON in the settings folder. Is it feasible/possible to be able to access .env file values at the root of the folder to be accessible by the extension? Maybe via {{$dotenv PORT}} for a file named .env and {{$dotenvLocal PORT}} for a .env.local file?

@Huachao
Copy link
Owner

Huachao commented Oct 17, 2019

@mattwaler nice suggestion, I will implement it and update in this thread later

Huachao added a commit that referenced this issue Oct 17, 2019
@Huachao
Copy link
Owner

Huachao commented Oct 17, 2019

@mattwaler @Ruegen @yfwz100 @devalnor I have supported the {{$dotenv variableName}} syntax, and you just need to put the .env file in the same folder of your .http file. However, .env.local file is not supported currently.

@Huachao Huachao closed this as completed Oct 17, 2019
@mattwaler
Copy link
Author

Awesome! Thank you so much for this amazing extension.

@Huachao
Copy link
Owner

Huachao commented Nov 20, 2019

@mattwaler @Ruegen @yfwz100 @devalnor you can try the latest version 0.23.0 to verify it.

@yfwz100
Copy link

yfwz100 commented Nov 21, 2019

It works, Thanks!

@tomdavidson
Copy link

Is the use case of {{$dotenv variableName}} in an environment variable value supported?

@mattwaler
Copy link
Author

@tomdavidson Yes, when the .env file and .http file are in the same directory this works as intended.

@tomdavidson
Copy link

tomdavidson commented Jan 16, 2020

@mattwaler thanks, ill open up a new issue then - #489

@rufreakde
Copy link

rufreakde commented Jan 29, 2024

@Huachao does this syntax also work in the workspace config?

  "rest-client.certificates": {
    "<domain>": {
      "pfx": "test/some/path/dev/cert", //change the p12 cert paths for different landscapes
      "passphrase": "{{$dotenv pass}}" //p12 passphrase

This seems not to work any pointers here?

Issue:
#1135

@shaunakv1
Copy link

@Huachao can we specify the location of .env file? or walk up to the root of current vscode project? My .env file usually lives in the root of code, and .http files are in a test directory

@nazarEnzo
Copy link

.env does not have to be in the same folder anymore. I used existing .env in the root of the project while making requests from subfolders and it works perfectly fine 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants