Search code examples
ruby-on-railsiron.ioironworker

What is the recommended way of storing db connection strings in an IronWorker


It's common practice on Heroku to have environment variables hold sensitive credentials so that one doesn't need to check in a passsword file into git.

Is there something similar for IronWorkers? How should one go about passing db connection strings to an IronWorker that has to connect to a database? Ideally, I would like to avoid having usernames and passwords in database.yml.

eg:

$ heroku config

HEROKU_POSTGRESQL_CYAN_URL: postgres://mmuxxxxxxxnhzp:X0JdWLxxxcJQ4ffO0xTjO6scJr@ec2-23-23-214-251.compute-1.amazonaws.com:5432/de11tlh7iq999x

$ heroku config:set SOMEVAR=somevalue

SOMEVAR=somevalue

Any help would be appreciated!

Thanks, Dimitri


Solution

  • 1) Merge config file into package

    2) upload worker with --worker-config flag.e.g. iron_worker upload hello.worker --worker-config cfg.json and use config helper inside worker.

    3) Pass connection data via payload