Aidan Gomez
Aidan Gomez

Reputation: 8637

Dynamic files across Heroku dynos

I understand that Heroku preserves it's filesystem in a running dyno ephemerally, wiping changes once a day when the dyno cycles.

I use a simple .txt file to store some frequently used and updated authentication keys.

Aside: A text file is an awful way to do this, would love to be told a bit about security best practices for storing keys, but, I understand how massive that lesson would be and the amount of resources already present for me to research myself. So, don't worry about it.

The problem is, I constantly refresh these keys, and rewrite the text file. So when the dyno cycles and resets the keys to their initial state, they are no longer valid. What alternative methods do I have to make sure that the keys are synced across dynos and are always up to date?

I am using a Django app, so I have access to creating a Model, which would probably be my first guess at how to go about this.

Thank you in advance.

Upvotes: 0

Views: 163

Answers (1)

John Beynon
John Beynon

Reputation: 37507

Use config vars - these get set into the environment on each dyno. Updating the key restarts the app. https://devcenter.heroku.com/articles/config-vars

Upvotes: 1

Related Questions