laserlemon / figaro

Simple Rails app configuration
MIT License
3.77k stars 288 forks source link

Sinatra - return no values from application.yml #221

Open belgoros opened 9 years ago

belgoros commented 9 years ago

I can't figure out why my Figaro keys are not recognized in a Sinatra app:

#main.rb

require 'sinatra'
require 'sinatra/reloader' if development?
require 'figaro'

get '/:logger' do
  logger = params[:logger]
  message = Figaro.env.message?
  "Using logger: #{logger} said #{message}"
end

Here the application.yml:

jar: org.apache.log4J
pattern: ddMMyyyy
level: INFO
message: Hey LOG4J

When I run ruby main.rband access to http://localhost:4567/log4j, I always get:

Using logger: log4j said false

my config.ru file:

require 'sinatra'
require 'figaro'
require './main'

run Sinatra::Application

Any idea on what is wrong here ? Thank you.

bpaquet commented 8 years ago

Please see https://github.com/laserlemon/figaro/pull/229

belgoros commented 8 years ago

@bpaquet: thank you for sharing, I'll take a try.