{"action":"opened","issue":{"url":"https://api.github.com/repos/nelsonic/esta/issues/72","labels_url":"https://api.github.com/repos/nelsonic/esta/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/nelsonic/esta/issues/72/comments","events_url":"https://api.github.com/repos/nelsonic/esta/issues/72/events","html_url":"https://github.com/nelsonic/esta/issues/72","id":68635149,"number":72,"title":"Remove the requirement to set environment variables before being able to use esta ?","user":{"login":"nelsonic","id":194400,"avatar_url":"https://avatars.githubusercontent.com/u/194400?v=3","gravatar_id":"","url":"https://api.github.com/users/nelsonic","html_url":"https://github.com/nelsonic","followers_url":"https://api.github.com/users/nelsonic/followers","following_url":"https://api.github.com/users/nelsonic/following{/other_user}","gists_url":"https://api.github.com/users/nelsonic/gists{/gist_id}","starred_url":"https://api.github.com/users/nelsonic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nelsonic/subscriptions","organizations_url":"https://api.github.com/users/nelsonic/orgs","repos_url":"https://api.github.com/users/nelsonic/repos","events_url":"https://api.github.com/users/nelsonic/events{/privacy}","received_events_url":"https://api.github.com/users/nelsonic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-15T10:03:34Z","updated_at":"2015-04-15T10:03:34Z","closed_at":null,"body":"Hi @FilWisher & @NaomiGaynor\r\nGiven that you are my biggest \"stakeholders\" in this project (*for now*...).\r\nI would :heart: to have your insight on weather we should have \"defaults\" for the values of **ES_HOST** and **ES_PORT** instead of requiring people to ***set** the **environment variables** ***before*** they can use this module in their project! https://github.com/nelsonic/esta#required-use-environment-variables-for-host--port-\r\n\r\n@iteles has been caught out a few times by not having environment variables set while trying to run our **Time** project: https://github.com/ideaq/time/issues/93 (because on Mac, when you shut down your computer you - *often* - lose your environment variables ... its annoying and un-beginner-friendly!)\r\n\r\nYet, I still like the idea of being able to set the **ES_INDEX** using an env var to have separate indexes (aka 'database' in relational db land) for test/staging/prod/etc\r\n\r\nSo, what I am proposing is the following:\r\n\r\nsetup the connection by ***default*** to `127.0.0.1:9200` when people are working on their **localhost** (i.e. during dev) and only require people to set a ***specific*** url for their ElasticSearch cluster (or 3rd party provider) when they move to Staging or Production.\r\n\r\nGiven that \"*we*\" (**dwyl** aka project '***Time***\") are using **SearchBox** on heroku for our app as discussed in: https://github.com/ideaq/time/issues/2) I have added a check for `process.env.SEARCHBOX_SSL_URL` in the *next release* of **esta**:\r\n[/lib/options.js#L12](https://github.com/nelsonic/esta/blob/09c0b6d315d73da634f8b017606ccca09c2ad6c9/lib/options.js#L12)\r\n\r\nWe will still allow people to ***optionally*** set the **process.env.ES_INDEX** so they can have separate indexes for dev/stage/prod if they *want* to.\r\n\r\n"}}