Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

471
Views
.env file variables are unable to read

my (.env file) variables are not reading in Nestjs, how do I format it in my VSC editor to execute it. Appreciate anybody could help or advise on this. Thank you guys

PORT="3000"
API_PREFIX="/api/v1"

#Rabbit MQ
RABBITMQ_CONN_STRING="amqp://guest:guest@localhost:8888/"
RABBITMQ_Q_NAME="hcert-root-message"
# DB
MONGO_URL ="mongodb://localhost/jcerts-backend"

# Passport-JWT
JWT_SEC="kepler-jwt-secret"

# Mailer
AWS_ACCESS_KEY_ID= #
AWS_SECRET_ACCESS_KEY= # AWS key for SES
BASEURL= "http://localhost:3000"

# Smart Contracts

#ropsten infura
PROVIDER_HTTP= https://ropsten.infura.io/v3/63de3b382a7c4d30954ed8bf912xxxxx
INFURA_VERSION="v3"
INFURA_ID="63de3b382a7c4d30954ed8bf91xxxxx"

# OTP Required
OTP_REQUIRED_SIGN_IN = false
OTP_REQUIRED_SIGN_UP = true
OTP_REQUIRED_SIGNING = true
OTP_REQUIRED_NOAISSUE = true

# Wallet ropsten                 
WALLET_PRIV = "e70694578f637de71fc4dcd68a1d4ba418db6ebc61f9072ea52e4bxxxxxxxxx"
WALLET_ADDR = "0xEB8EaC9396267DEbe493fFc80xxxxxxxxx"

VALUE = "0.5"
GAS_PRICE_PREMIUM_PCT="10"
GAS_LIMIT="70000"
GAS_LIMIT_DOCSTORE="1500000"
ISSUEDOC_NETWORK = "ropsten"

# ropsten
DOCSTORE_FACTORY="0xb539d81F709b23D1039A19596AA19xxxxxxxxxx"  

enter image description here

enter image description here

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Click at the bottom where it says JSON

enter image description here

Type in env and select Environment Variables

enter image description here

You also need to update your env file:

  • Don't use quotes
  • Don't have spaces around ='s

If for some reason this still isn't working or Environment Variables isn't an option, install this VS Code extension:

Name: ENV

Id: irongeek.vscode-env

Description: Adds formatting and syntax highlighting support for env files (.env) to Visual Studio Code

Version: 0.1.0

Publisher: Jakka Prihatna

VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=IronGeek.vscode-env

Finally, if all of this doesn't work, make sure your .env file is in the correct folder.

If Nestjs doesn't come with dotenv, you'll need to set it up yourself

about 4 years ago · Juan Pablo Isaza Report

0

Check url param where i used env variable, by this way you can get and use variable value. it will help you out.

 var restaurants_id = 1;
    restaurants_name = "hello";
    restaurants_code = 2903483;
    $.ajax({
        type: 'post',
        url: ***'{{env("DB_HOST")}}',***
        data: {
            'restaurants_id': restaurants_id,
            'restaurants_name': restaurants_name,
            'restaurants_code': restaurants_code
        },
        success: function(data) {
            console.log(data);
            
        }
    });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!