You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the dotenv library exposes the following methods:
config
parse
populate
decrypt
I'd love to be able to write to the .env file, or patch it with existing variables.
Example:
const envVars = {
API-KEY: "555",
SECRET: 123
}
dotenv.write(envVars, file); // Writes the provided object into the .env file
const envVarsPatch = {
API-KEY: "444",
}
dotenv.patch(envVarsPatch, file); // If the environment variables provided in the object exist in the file, update it; or else insert it
Some edge case considerations:
If the value contains a new-line, enclose the variable value in double quotes
If the string contains double quotes, use single quotes; if the string contains single & double quotes, use tilde
dotenv.patch should be able to ignore comments and bad characters in the file
The text was updated successfully, but these errors were encountered:
Currently, the dotenv library exposes the following methods:
I'd love to be able to write to the .env file, or patch it with existing variables.
Example:
Some edge case considerations:
dotenv.patch
should be able to ignore comments and bad characters in the fileThe text was updated successfully, but these errors were encountered: