Skip to content
Advertisement

How to write to enviornment variables on Heroku

I have made a website meant to me used by only one person, so I want to dynamically write to .env file on Heroku without it resting,
because this is meant only for one person. I don’t want to deal with a database.

Something like this:

require(`dotenv`).config();

console.log(process.env.MYVAL); // Not my value
process.env.MYVAL = "MYVAL"
console.log(process.env.MYVAL); // MYVAL

Advertisement

Answer

You could use the heroku api to do that
but it will have to restart the dyno Docs

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement