{"action":"created","issue":{"url":"https://api.github.com/repos/SpoonX/aurelia-api/issues/21","labels_url":"https://api.github.com/repos/SpoonX/aurelia-api/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/SpoonX/aurelia-api/issues/21/comments","events_url":"https://api.github.com/repos/SpoonX/aurelia-api/issues/21/events","html_url":"https://github.com/SpoonX/aurelia-api/issues/21","id":128403267,"number":21,"title":"Environment based Endpoints","user":{"login":"MarcScheib","id":5886709,"avatar_url":"https://avatars.githubusercontent.com/u/5886709?v=3","gravatar_id":"","url":"https://api.github.com/users/MarcScheib","html_url":"https://github.com/MarcScheib","followers_url":"https://api.github.com/users/MarcScheib/followers","following_url":"https://api.github.com/users/MarcScheib/following{/other_user}","gists_url":"https://api.github.com/users/MarcScheib/gists{/gist_id}","starred_url":"https://api.github.com/users/MarcScheib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarcScheib/subscriptions","organizations_url":"https://api.github.com/users/MarcScheib/orgs","repos_url":"https://api.github.com/users/MarcScheib/repos","events_url":"https://api.github.com/users/MarcScheib/events{/privacy}","received_events_url":"https://api.github.com/users/MarcScheib/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-24T15:10:41Z","updated_at":"2016-01-25T21:28:23Z","closed_at":null,"body":"Hi,\r\n\r\nwould it be possible to implement endpoint selection based on environments?\r\nWhat I would like to do is something like this:\r\n\r\n```\r\nconfig.registerEndpoint('dev', 'https://localhost);\r\nconfig.registerEndpoint('stage', 'https://staging.xyz.de/');\r\nconfig.registerEndpoint('production', 'https://xyz.de/');\r\nconfig.setEnvironments({\r\n        development: ['localhost'],\r\n        stage: ['staging.xyz.de'],\r\n        production: ['xyz.de']\r\n      });\r\n.setDefaultEndpoint(basedOnEnvironments);\r\n```\r\n\r\nThe import part would be the setDefaultEndpoint(). Based on the param, I can tell your plugin to select the default endpoint based on my configured environments (which is more or less a mapping between hostname and endpoint). \r\nPerhaps it is also possible to skip the definition of environments and simply say, if I want an environment based default endpoint, search for the one with the correct hostname in all registered ones.\r\n\r\nBest Regards\r\nMarc\r\n"},"comment":{"url":"https://api.github.com/repos/SpoonX/aurelia-api/issues/comments/174670869","html_url":"https://github.com/SpoonX/aurelia-api/issues/21#issuecomment-174670869","issue_url":"https://api.github.com/repos/SpoonX/aurelia-api/issues/21","id":174670869,"user":{"login":"MarcScheib","id":5886709,"avatar_url":"https://avatars.githubusercontent.com/u/5886709?v=3","gravatar_id":"","url":"https://api.github.com/users/MarcScheib","html_url":"https://github.com/MarcScheib","followers_url":"https://api.github.com/users/MarcScheib/followers","following_url":"https://api.github.com/users/MarcScheib/following{/other_user}","gists_url":"https://api.github.com/users/MarcScheib/gists{/gist_id}","starred_url":"https://api.github.com/users/MarcScheib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarcScheib/subscriptions","organizations_url":"https://api.github.com/users/MarcScheib/orgs","repos_url":"https://api.github.com/users/MarcScheib/repos","events_url":"https://api.github.com/users/MarcScheib/events{/privacy}","received_events_url":"https://api.github.com/users/MarcScheib/received_events","type":"User","site_admin":false},"created_at":"2016-01-25T21:28:23Z","updated_at":"2016-01-25T21:28:23Z","body":"I was rethinking a little bit. Is it the following you plan to do?\r\n\r\n```\r\nif (window.location.hostname contains stage.xyz.de)\r\n    config = stage.xyz.de\r\nelse if (.... contains dev.xyz.de)\r\n    config = dev.xyz.de\r\n\r\nexport default config;\r\n```"}}