jeudi 18 juin 2020

How can I securely store a ruby hash in Rails?

I need to map to different logic based on a unique id parameter. I essentially want to do the following:

{
  'id123' => send(:foo),
  'id789' => send(:bar)
}

I wouldn't want to hardcode the variables, and storing each ID in a separate environment variable is tedious and difficult to keep track of. The best solution I can think of is converting the hash to a string to store as an env var, then converting back to a hash when I initialize the app but I'm wondering if there is a better way?

Aucun commentaire:

Enregistrer un commentaire