laserlemon / figaro

Simple Rails app configuration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sinatra - return no values from application.yml

belgoros opened this issue · comments

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.

Please see #229

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