{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/19256","labels_url":"https://api.github.com/repos/rails/rails/issues/19256/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/19256/comments","events_url":"https://api.github.com/repos/rails/rails/issues/19256/events","html_url":"https://github.com/rails/rails/issues/19256","id":60250567,"number":19256,"title":"Rails console doesn't use DATABASE_URL environment variable","user":{"login":"andrewhamon","id":5134584,"avatar_url":"https://avatars.githubusercontent.com/u/5134584?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewhamon","html_url":"https://github.com/andrewhamon","followers_url":"https://api.github.com/users/andrewhamon/followers","following_url":"https://api.github.com/users/andrewhamon/following{/other_user}","gists_url":"https://api.github.com/users/andrewhamon/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewhamon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewhamon/subscriptions","organizations_url":"https://api.github.com/users/andrewhamon/orgs","repos_url":"https://api.github.com/users/andrewhamon/repos","events_url":"https://api.github.com/users/andrewhamon/events{/privacy}","received_events_url":"https://api.github.com/users/andrewhamon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-03-08T10:22:45Z","updated_at":"2016-01-05T07:32:37Z","closed_at":"2015-03-09T02:33:41Z","body":"If I have `DATABASE_URL` set and run `rails c` the settings in config/database.yml are used even though `DATABASE_URL` should override the settings. If I delete database.yml entirely, then I get the following error: `Could not load database configuration. No such file - [\"config/database.yml\"] (RuntimeError)`.\r\n\r\nIn irb I can run `ENV['DATABASE_URL']` and get the correct URL so I know the environment variable is correctly set.\r\n\r\n[This rails guide](http://guides.rubyonrails.org/configuring.html#configuring-a-database) seems to indicate that database.yml is optional and indeed I can run a server with `rails s` even with no database.yml present.\r\n\r\nPerhaps this is by design, but I can't imagine why the `DATABASE_URL` would be ignored when using a rails console."},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/168923691","html_url":"https://github.com/rails/rails/issues/19256#issuecomment-168923691","issue_url":"https://api.github.com/repos/rails/rails/issues/19256","id":168923691,"user":{"login":"duleorlovic","id":1426092,"avatar_url":"https://avatars.githubusercontent.com/u/1426092?v=3","gravatar_id":"","url":"https://api.github.com/users/duleorlovic","html_url":"https://github.com/duleorlovic","followers_url":"https://api.github.com/users/duleorlovic/followers","following_url":"https://api.github.com/users/duleorlovic/following{/other_user}","gists_url":"https://api.github.com/users/duleorlovic/gists{/gist_id}","starred_url":"https://api.github.com/users/duleorlovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duleorlovic/subscriptions","organizations_url":"https://api.github.com/users/duleorlovic/orgs","repos_url":"https://api.github.com/users/duleorlovic/repos","events_url":"https://api.github.com/users/duleorlovic/events{/privacy}","received_events_url":"https://api.github.com/users/duleorlovic/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T07:32:37Z","updated_at":"2016-01-05T07:32:37Z","body":":+1:  @haihappen  `spring stop` works for me too"}}