autocode
Version:
the ultimate developer platform
42 lines (40 loc) • 1 kB
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.autocode.run/";
}
break;
case 'hub':
if (process.env.CRYSTAL_HUB_URL) {
return process.env.CRYSTAL_HUB_URL;
} else {
return "https://hub.autocode.run/";
}
break;
case 'web':
if (process.env.CRYSTAL_WEB_URL) {
return process.env.CRYSTAL_WEB_URL;
} else {
return "https://autocode.run/";
}
}
})();
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);