{"action":"created","issue":{"url":"https://api.github.com/repos/sinatra/sinatra/issues/1193","repository_url":"https://api.github.com/repos/sinatra/sinatra","labels_url":"https://api.github.com/repos/sinatra/sinatra/issues/1193/labels{/name}","comments_url":"https://api.github.com/repos/sinatra/sinatra/issues/1193/comments","events_url":"https://api.github.com/repos/sinatra/sinatra/issues/1193/events","html_url":"https://github.com/sinatra/sinatra/issues/1193","id":184828357,"number":1193,"title":"Can't get Sinatra::ConfigFile to work, always returns []","user":{"login":"gonace","id":813996,"avatar_url":"https://avatars.githubusercontent.com/u/813996?v=3","gravatar_id":"","url":"https://api.github.com/users/gonace","html_url":"https://github.com/gonace","followers_url":"https://api.github.com/users/gonace/followers","following_url":"https://api.github.com/users/gonace/following{/other_user}","gists_url":"https://api.github.com/users/gonace/gists{/gist_id}","starred_url":"https://api.github.com/users/gonace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonace/subscriptions","organizations_url":"https://api.github.com/users/gonace/orgs","repos_url":"https://api.github.com/users/gonace/repos","events_url":"https://api.github.com/users/gonace/events{/privacy}","received_events_url":"https://api.github.com/users/gonace/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-24T12:36:23Z","updated_at":"2016-10-24T13:39:28Z","closed_at":null,"body":"Hi \r\nI've been struggling with Sinatra::ConfigFile and giving up so many times to get it to work and never have found a solution.\r\n\r\nI'm running a simple Sinatra application that now need a config file with a base url.\r\n\r\n\r\nHere is my BaseController:\r\n```\r\nclass BaseController < Sinatra::Base\r\n  register Sinatra::ConfigFile\r\n  register Sinatra::Flash\r\n  register Sinatra::Partial\r\n\r\n  enable :sessions\r\n  set :environments, %w{development test production stage}\r\n\r\n  env = ENV['RACK_ENV'] || 'development'\r\n  config_file \"config/#{env}.config.yml\"\r\n\r\n  file = File.open(\"config/#{env}.config.yml\", 'rb')\r\n\r\n  puts '#################'\r\n  puts '###   DEBUG   ###'\r\n  puts '#################'\r\n  pp file.read\r\n  puts env\r\n  p config_file\r\n  puts settings.inspect\r\n  puts '#################'\r\nend\r\n```\r\n\r\nBut the config_file is always []:\r\n```\r\n14:33:18 app.1  | #################\r\n14:33:18 app.1  | ###   DEBUG   ###\r\n14:33:18 app.1  | #################\r\n14:33:18 app.1  | \"development:\\n  foo: development\\n  bar: bar\\ntest:\\n  foo: test\\n  bar: bar\\nproduction:\\n  foo: production\\n  bar: bar\"\r\n14:33:18 app.1  | production\r\n14:33:18 app.1  | []\r\n14:33:19 app.1  | BaseController\r\n14:33:19 app.1  | #################\r\n```\r\n\r\nI've tested adding the example in the documentation to the actual application class with the same result.\r\n\r\nAnyone that have an idea?"},"comment":{"url":"https://api.github.com/repos/sinatra/sinatra/issues/comments/255742922","html_url":"https://github.com/sinatra/sinatra/issues/1193#issuecomment-255742922","issue_url":"https://api.github.com/repos/sinatra/sinatra/issues/1193","id":255742922,"user":{"login":"gonace","id":813996,"avatar_url":"https://avatars.githubusercontent.com/u/813996?v=3","gravatar_id":"","url":"https://api.github.com/users/gonace","html_url":"https://github.com/gonace","followers_url":"https://api.github.com/users/gonace/followers","following_url":"https://api.github.com/users/gonace/following{/other_user}","gists_url":"https://api.github.com/users/gonace/gists{/gist_id}","starred_url":"https://api.github.com/users/gonace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonace/subscriptions","organizations_url":"https://api.github.com/users/gonace/orgs","repos_url":"https://api.github.com/users/gonace/repos","events_url":"https://api.github.com/users/gonace/events{/privacy}","received_events_url":"https://api.github.com/users/gonace/received_events","type":"User","site_admin":false},"created_at":"2016-10-24T13:39:28Z","updated_at":"2016-10-24T13:39:28Z","body":"Hi\r\nI've removed that line you're reffering to but if I try to\r\n`puts settings.fo`\r\n\r\nI get \r\n`/Users/gonace/Development/Tulo/mittmedia-shop-url-resolver/controllers/BaseController.rb:17:in `block in <class:BaseController>': undefined method `foo' for BaseController:Class (NoMethodError)`"}}
{"actor":{"display_login":"gonace"}}