{"action":"created","issue":{"url":"https://api.github.com/repos/mneudert/instream/issues/13","labels_url":"https://api.github.com/repos/mneudert/instream/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/mneudert/instream/issues/13/comments","events_url":"https://api.github.com/repos/mneudert/instream/issues/13/events","html_url":"https://github.com/mneudert/instream/issues/13","id":120458936,"number":13,"title":"Mix with custom configuration","user":{"login":"ibizaman","id":1044950,"avatar_url":"https://avatars.githubusercontent.com/u/1044950?v=3","gravatar_id":"","url":"https://api.github.com/users/ibizaman","html_url":"https://github.com/ibizaman","followers_url":"https://api.github.com/users/ibizaman/followers","following_url":"https://api.github.com/users/ibizaman/following{/other_user}","gists_url":"https://api.github.com/users/ibizaman/gists{/gist_id}","starred_url":"https://api.github.com/users/ibizaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibizaman/subscriptions","organizations_url":"https://api.github.com/users/ibizaman/orgs","repos_url":"https://api.github.com/users/ibizaman/repos","events_url":"https://api.github.com/users/ibizaman/events{/privacy}","received_events_url":"https://api.github.com/users/ibizaman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-04T18:31:02Z","updated_at":"2015-12-22T10:36:37Z","closed_at":null,"body":"How would you add custom configuration keys to the config.exs?\r\n\r\nFor example I would like to set the database I am talking to by adding a database key like so:\r\n\r\n```elixir\r\nconfig :influxdb, InfluxDB.Connection,\r\n  hosts:  [\"localhost\"],\r\n  pool:   [max_overflow: 0, size: 1]\r\n  port:   8086,\r\n  scheme: \"http\",\r\n  write:  Instream.Writer.Line,\r\n  database: \"test\"\r\n```\r\n\r\nBut if fails horribly with:\r\n\r\n```\r\n  failure on setup_all callback, tests invalidated\r\n     ** (FunctionClauseError) no function clause matching in Regex.match?/2\r\n     stacktrace:\r\n       (elixir) lib/regex.ex:158: Regex.match?(~r/^[a-zA-Z0-9_\\-]+$/, nil)\r\n       (instream) lib/instream/validate.ex:13: Instream.Validate.database!/1\r\n       (instream) lib/instream/cluster/database.ex:18: Instream.Cluster.Database.create/2\r\n       test/influxdb_test.exs:7: InfluxDBTest.__ex_unit_setup_all_0/1\r\n       test/influxdb_test.exs:1: InfluxDBTest.__ex_unit__/2\r\n```"},"comment":{"url":"https://api.github.com/repos/mneudert/instream/issues/comments/166577691","html_url":"https://github.com/mneudert/instream/issues/13#issuecomment-166577691","issue_url":"https://api.github.com/repos/mneudert/instream/issues/13","id":166577691,"user":{"login":"ibizaman","id":1044950,"avatar_url":"https://avatars.githubusercontent.com/u/1044950?v=3","gravatar_id":"","url":"https://api.github.com/users/ibizaman","html_url":"https://github.com/ibizaman","followers_url":"https://api.github.com/users/ibizaman/followers","following_url":"https://api.github.com/users/ibizaman/following{/other_user}","gists_url":"https://api.github.com/users/ibizaman/gists{/gist_id}","starred_url":"https://api.github.com/users/ibizaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibizaman/subscriptions","organizations_url":"https://api.github.com/users/ibizaman/orgs","repos_url":"https://api.github.com/users/ibizaman/repos","events_url":"https://api.github.com/users/ibizaman/events{/privacy}","received_events_url":"https://api.github.com/users/ibizaman/received_events","type":"User","site_admin":false},"created_at":"2015-12-22T10:36:37Z","updated_at":"2015-12-22T10:36:37Z","body":"I could not reproduce the error. But still, here is how it does *not* work:\r\n```ruby\r\nconfig :influxdb, InfluxDB.Connection,\r\n  hosts:  [\"localhost\"],\r\n  pool:   [max_overflow: 0, size: 1]\r\n  port:   8086,\r\n  scheme: \"http\",\r\n  write:  Instream.Writer.Line,\r\n  my_param: \"my_value\"\r\n\r\n$ Application.get_all_env\r\n[{:port, 6001},\r\n {WPI.InfluxDB.Connection,\r\n  [hosts: [\"localhost\"],\r\n   pool: [max_overflow: 0, size: 1],\r\n   port: 8086,\r\n   scheme: \"http\",\r\n   writer: Instream.Writer.Line,\r\n   my_param: \"my_value\"]},\r\n {:included_applications, []},\r\n {:test_mode, true}\r\n]\r\n```\r\n\r\nIn fact, the config must be split in two:\r\n```ruby\r\nconfig :influxdb, InfluxDB.Connection,\r\n  hosts:  [\"localhost\"],\r\n  pool:   [max_overflow: 0, size: 1]\r\n  port:   8086,\r\n  scheme: \"http\",\r\n  write:  Instream.Writer.Line,\r\n\r\nconfig :influxdb,\r\n  my_param: \"my_value\"\r\n\r\n$ Application.get_all_env\r\n[{:port, 6001},\r\n {WPI.InfluxDB.Connection,\r\n  [hosts: [\"localhost\"],\r\n   pool: [max_overflow: 0, size: 1],\r\n   port: 8086,\r\n   scheme: \"http\",\r\n   writer: Instream.Writer.Line]},\r\n {:my_param, \"my_value\"},\r\n {:included_applications, []},\r\n {:test_mode, true}\r\n]\r\n```"}}