This is the scenario: my Node.js app creates a file on the server that stores all user data (nothing sensitive) in a file called database.json.
I currently have two environments:
- my local machine, with a
database.json, - and my production environment on Heroku, with its own
database.json
Every time I push a new version of my app, from my machine to production, I would not like to replace the production database.json file with the one I have in my machine. For that, I used the .gitignore to ignore this file, so this file is not on GitHub, because it is created within the app execution
But every time I push a new version to Heroku, instead of keeping the old database.json file, Heroku erases it. It looks like Heroku completely overwrites all the app folder with the one downloaded from Git instead of "merging" with what is already there.
How can I set up a file on Heroku that I can use to save user data that is not affected by git pushes and deploys?