{"action":"created","issue":{"url":"https://api.github.com/repos/adhearsion/adhearsion/issues/442","labels_url":"https://api.github.com/repos/adhearsion/adhearsion/issues/442/labels{/name}","comments_url":"https://api.github.com/repos/adhearsion/adhearsion/issues/442/comments","events_url":"https://api.github.com/repos/adhearsion/adhearsion/issues/442/events","html_url":"https://github.com/adhearsion/adhearsion/issues/442","id":28006997,"number":442,"title":"Minor: Adhearsion falsely warns that custom environments aren't supported","user":{"login":"sfgeorge","id":208529,"avatar_url":"https://avatars.githubusercontent.com/u/208529?v=3","gravatar_id":"","url":"https://api.github.com/users/sfgeorge","html_url":"https://github.com/sfgeorge","followers_url":"https://api.github.com/users/sfgeorge/followers","following_url":"https://api.github.com/users/sfgeorge/following{/other_user}","gists_url":"https://api.github.com/users/sfgeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/sfgeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfgeorge/subscriptions","organizations_url":"https://api.github.com/users/sfgeorge/orgs","repos_url":"https://api.github.com/users/sfgeorge/repos","events_url":"https://api.github.com/users/sfgeorge/events{/privacy}","received_events_url":"https://api.github.com/users/sfgeorge/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/adhearsion/adhearsion/milestones/18","html_url":"https://github.com/adhearsion/adhearsion/milestones/3.0.0","labels_url":"https://api.github.com/repos/adhearsion/adhearsion/milestones/18/labels","id":403073,"number":18,"title":"3.0.0","description":"","creator":{"login":"benlangfeld","id":210221,"avatar_url":"https://avatars.githubusercontent.com/u/210221?v=3","gravatar_id":"","url":"https://api.github.com/users/benlangfeld","html_url":"https://github.com/benlangfeld","followers_url":"https://api.github.com/users/benlangfeld/followers","following_url":"https://api.github.com/users/benlangfeld/following{/other_user}","gists_url":"https://api.github.com/users/benlangfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/benlangfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benlangfeld/subscriptions","organizations_url":"https://api.github.com/users/benlangfeld/orgs","repos_url":"https://api.github.com/users/benlangfeld/repos","events_url":"https://api.github.com/users/benlangfeld/events{/privacy}","received_events_url":"https://api.github.com/users/benlangfeld/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":24,"state":"open","created_at":"2013-08-15T23:21:32Z","updated_at":"2015-06-23T19:10:06Z","due_on":"2015-08-31T03:00:00Z","closed_at":null},"comments":6,"created_at":"2014-02-20T23:42:11Z","updated_at":"2015-06-24T12:44:31Z","closed_at":null,"body":"FYI This is a cosmetic issue.  Functionally I have exactly what I want (running a custom environment name), I just figured we can tighten the logging to not falsely report warnings.\r\n\r\nI have an application uses the following:\r\n\r\nRuby:  jruby-1.7.4\r\n\r\nGems\r\n* Adhearsion v2.5.0\r\n* Rails 3.2.12\r\n\r\nPertinent environment variables\r\n* RAILS_ENV=integration\r\n* AHN_ENV=integration\r\n* AHN_PLATFORM_ENVIRONMENT=integration\r\n\r\nStartup procedure\r\n    <ENV variables> rvm jruby-1.7.4 exec bundle exec ahn start .\r\n\r\n#### Observed behavior:\r\n\r\nThe log messages in adhearsion.log tell conflicting stories...\r\n\r\n    You tried to initialize with an invalid environment name integration. Valid values are [:production, :development, :staging, :test].\r\n    ...\r\n    [2014-02-20 18:08:20.026] INFO  Adhearsion::Initializer: Adhearsion v2.5.0 initialized in \"integration\"!\r\n\r\nThe interesting thing is that both [message 1](https://github.com/adhearsion/adhearsion/blob/v2.5.0/lib/adhearsion.rb#L76-L79) and [message 2](https://github.com/adhearsion/adhearsion/blob/v2.5.0/lib/adhearsion/initializer.rb#L70) are talking about the same configuration variable, `config.platform.environment`.\r\n\r\n_Additionally, the first message is logged to STDOUT, which made it hard for me to discover it._"},"comment":{"url":"https://api.github.com/repos/adhearsion/adhearsion/issues/comments/114854958","html_url":"https://github.com/adhearsion/adhearsion/issues/442#issuecomment-114854958","issue_url":"https://api.github.com/repos/adhearsion/adhearsion/issues/442","id":114854958,"user":{"login":"benlangfeld","id":210221,"avatar_url":"https://avatars.githubusercontent.com/u/210221?v=3","gravatar_id":"","url":"https://api.github.com/users/benlangfeld","html_url":"https://github.com/benlangfeld","followers_url":"https://api.github.com/users/benlangfeld/followers","following_url":"https://api.github.com/users/benlangfeld/following{/other_user}","gists_url":"https://api.github.com/users/benlangfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/benlangfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benlangfeld/subscriptions","organizations_url":"https://api.github.com/users/benlangfeld/orgs","repos_url":"https://api.github.com/users/benlangfeld/repos","events_url":"https://api.github.com/users/benlangfeld/events{/privacy}","received_events_url":"https://api.github.com/users/benlangfeld/received_events","type":"User","site_admin":false},"created_at":"2015-06-24T12:44:31Z","updated_at":"2015-06-24T12:44:31Z","body":"See also https://github.com/adhearsion/adhearsion/pull/574, which removes `AHN_PLATFORM_ENVIRONMENT`, using only `AHN_ENV`. Still, though, we require you to use one of the defined environments. This is, as @bklang says, because top level config keys need to be declared. You could equally create a plugin whose config key is `integration` like so:\r\n\r\n```ruby\r\nclass MyPlugin < Adhearsion::Plugin\r\n  config :integration do\r\n    foo :bar\r\n  end\r\nend\r\n```\r\n\r\nand then set the value using `config.integration.foo.bar = :baz`. If you were to set this value in the development environment only, it would be: `config.development.integration.foo.bar = :baz`.\r\n\r\nAs you can see, with this syntax, Adhearsion's only way of differentiating between environment names and plugin named as the top level key is by registration, which for environment names is hard-coded in Adhearsion.\r\n\r\nWe could potentially deal with this by introducing a different syntax for declaring config per-environment, such as `config.env(:production).foo.bar`. This would mean that top-level config keys were no longer used for specifying config per-environment, and as such we could support any environment name you wish.\r\n\r\nDoes this option sound like a good way forward? It would have the beneficial side-effect of simplifying the `Adhearsion::Configuration` code a little bit, with the downside being that it would not be backwards compatible."}}