xxxxxxxxxx
require('dotenv').config()
console.log(process.env) // remove this after you've confirmed it is working
xxxxxxxxxx
//in your script file
import 'dotenv/config';
//alertnatively you can do this when you env file is not in your main folder
import dotenv from 'dotenv';
import path from 'path';
dotenv.config({path: './config/.env'});
//or
dotenv.config({path: path.resolve(__dirname, 'config/.env')});
xxxxxxxxxx
#in you cmd type this command
npm i dotenv
#and then require it in you javascript using :
require("dotenv").config()
dotenv is used in Node.js to load environment variables from a .env file into process.env at runtime, allowing developers to keep sensitive information, such as API keys or database passwords, separate from their code and stored securely. This helps to prevent accidental exposure of sensitive information in version control systems or deployment pipelines.
xxxxxxxxxx
must install dotenv package from terminal using
yarn add --dev dotenv
// this is under config.js
require("dotenv").config();
// RPC_url & Private key masked by dotenv
const GOERLI_RPC_URL = process.env.GOERLI_RPC_URL;
const PRIVATE_KEY = process.env.PRIVATE_KEY;
// This are under .env
GOERLI_RPC_URL = https://eth-goerli.g.alchemy.com/v2/QQCTg89Ei5ZfBUQ0Y5g0j_aN2PwmwX67
PRIVATE_KEY = f8494e7b7d5a8bd284150015ac99074c12ff3d7f06d574c837ea6a2a78918a17
ETHERSCAN_API_KEY = C419PC8HGZ6ZA7V3K41A9YRWTDMD3XDYCB
xxxxxxxxxx
/* Add this class where you need No pointer events on element. */
.noPointer {
pointer-events: none;
}