I saw this post and think something is missing or a change in version. I have a very simple rack app using figaro -- hosted with Heroku. Currently, Im on local machine.
I now need to use ENV.
My app structure:
APP
|_ config/
|_ public/
|_ views/
|_ config.ru
|_ app.rb
|_ other-files
Inside config/application.yml
SOME_KEY: some-value
Inside config.ru
require './app.rb'
run MyApp.run!
This the part this gives the error. Inside app.rb:
require File.dirname(__FILE__) + '/config/application.yml'
[...]
This is the same line as in the link above. I get
cannot load such file /config/application.yml
In app.rb, I need to be able to do ENV['SOME_KEY']
You can't just
requirea yaml file as it is not ruby. Yaml is a file structure that is not ruby specific. Figaro was also written to be used with Ruby on Rails, not Sinatra. You can probably figure out a way to make it work, but it's not as easy as just loading a yaml config file.See this post for some ideas of how you might accomplish what you're trying to do. Here is a forked version of the gem which might work for you.
https://github.com/laserlemon/figaro/pull/229