简体   繁体   中英

How do I host and edit a JSON file separate from my GitHub repository?

I'm building a Discord bot and am trying to host it with Heroku and GitHub. I intend to store user data in a JSON file but cannot figure out how to edit the JSON file because I cannot edit it while it is in the repository. I am hoping there is a way to do it through Heroku, without using a separate website.

Note: I know how you would normally edit the JSON file, but because it is in a GitHub Repository it doesn't work the normal way.

Don't use a file as a database. Use a database as a database.

This is generally good advice, but especially important on Heroku where the ephemeral filesystem prevents changes to files from persisting long-term.

Heroku Postgres is a relatively easy way to get started. Its base plan is free.

I believe GitLab allows you to edit files in place, and they have a free tier like Github. As mentioned by Chris, this is generally not recommended, but it may work for your needs.

https://about.gitlab.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM