autocode-cli
Version:
code automation for every language, framework and platform
42 lines (40 loc) • 999 B
JavaScript
// Generated by CoffeeScript 1.10.0
(function() {
module.exports = function(host, uri) {
var url;
url = (function() {
switch (host) {
case 'api':
if (process.env.CRYSTAL_API_URL) {
return process.env.CRYSTAL_API_URL;
} else {
return "https://api.crystal.sh/";
}
break;
case 'hub':
if (process.env.CRYSTAL_HUB_URL) {
return process.env.CRYSTAL_HUB_URL;
} else {
return "https://hub.crystal.sh/";
}
break;
case 'web':
if (process.env.CRYSTAL_WEB_URL) {
return process.env.CRYSTAL_WEB_URL;
} else {
return "https://crystal.sh/";
}
}
})();
if (!url) {
throw new Error("URL does not exist for host: " + host);
}
if (url.substr(url.length - 1) !== '/') {
url += '/';
}
if (uri) {
url += uri;
}
return url;
};
}).call(this);