figaro is not picking env var inside rails controller

86 Views Asked by At

I am using figaro gem in Rails 5.1. I have a custom bash script too that sets the ENV vars so that we do not have to set them in application.yml and still utilize Figaro.env.{var_name} to access those env var values. Today I noticed that in controllers figaro is not picking those ENV vars. Like in custom.sh, I have following S3_DEVELOPER_NAME: myname

and when I do Figaro.env.s3_developer_name inside controller, it is not outputting myname and rather outputting nil.

Can anybody adds something in my knowledge which I am missing?

Note: If i set s3_developer_name inside application.yml, it works fine in controller too.

1

There are 1 best solutions below

0
bert bruynooghe On

ENV variables are case sensitive, and so is Ruby. So if you define S3_DEVELOPER_NAME: myname, you should call it as Figaro.env.S3_DEVELOPER_NAME.