how to read and write from a to a file when the code is on github and deployed on railway?
i want to use the github repo to store varibles and debug logs for my python3 telegram bot how can i achieve it?
14 Replies
Project ID:
N/A
You might find these helpful:
- getting startet with railway
- using
gitpython
to pull a github repo and use the data⚠️ experimental feature
Environment variables?they should not be stored in your repo. And the logs are accessible via the website.
Using a custom logger you could upload the logs to s3 potentially
Or by using the cloudwatch sdk
Ig
no i want to store the varibles of settigns states per group in a seperate file to read them when the bot redeploys as i dont want to use a database is that possible?
Yes. You can do that
Just don't store secrets in git
its a pair of chat id and on or off per chat id
NEW_BOT_DETECTED_STATE = "on"
NEW_BOT_DETECTED_STATE_BY_CHAT = {}
NEW_BOT_DETECTEDAUTO_BAN_STATE = "on"
NEW_BOT_DETECTEDAUTO_BAN_STATE_BY_CHAT = {}
Yes you can dot that via the method you described
so i could define a json file for example put it in the same repo and than access it to read and write is that right?
Write, no. The changes won't persist to your gh repo
You could write if you expect your changes not to persist
so i need a external database for it do i understand it right?
That would be a good way to store persistent config that can be mutated by your app yea
thank you for the quick help
No worries
Gl
thanks