kopia lustrzana https://github.com/c9/core
Added logicblox as a custom provider and make logicblox projects only go to it
rodzic
c1cf69ff5c
commit
f0075ccab1
|
@ -2,25 +2,25 @@ var fs = require("fs");
|
|||
|
||||
exports.parse = function(hostname) {
|
||||
|
||||
var m1 = hostname.match(/^([0-9a-z-]+?)-gce-([a-z]+)-([0-9]+)-([a-z0-9]+)$/);
|
||||
var m2 = hostname.match(/^([0-9a-z-]+?)-gce-([a-z]+)-([a-z0-9]+)-([a-z0-9]{4})$/);
|
||||
var m1 = hostname.match(/^([0-9a-z-]+?)-([a-z]+)-([a-z]+)-([0-9]+)-([a-z0-9]+)$/);
|
||||
var m2 = hostname.match(/^([0-9a-z-]+?)-([a-z]+)-([a-z]+)-([a-z0-9]+)-([a-z0-9]{4})$/);
|
||||
|
||||
if (m1) {
|
||||
return {
|
||||
type: m1[1],
|
||||
provider: "gce",
|
||||
region: m1[2],
|
||||
index: m1[3],
|
||||
env: m1[4]
|
||||
provider: m1[2],
|
||||
region: m1[3],
|
||||
index: m1[4],
|
||||
env: m1[5]
|
||||
};
|
||||
}
|
||||
else if (m2) {
|
||||
return {
|
||||
type: m2[1],
|
||||
provider: "gce",
|
||||
region: m2[2],
|
||||
env: m2[3],
|
||||
index: m2[4]
|
||||
provider: m2[2],
|
||||
region: m2[3],
|
||||
env: m2[4],
|
||||
index: m2[5]
|
||||
};
|
||||
} else {
|
||||
return {};
|
||||
|
|
|
@ -10,16 +10,18 @@ var hostname = require("./hostname");
|
|||
|
||||
describe(__filename, function() {
|
||||
|
||||
function assertServerName(sn, type, region, index, env) {
|
||||
function assertServerName(sn, type, provider, region, index, env) {
|
||||
assert.equal(sn.type, type);
|
||||
assert.equal(sn.provider, provider);
|
||||
assert.equal(sn.region, region);
|
||||
assert.equal(sn.index, index);
|
||||
assert.equal(sn.env, env);
|
||||
}
|
||||
|
||||
it("parse hostname", function() {
|
||||
assertServerName(hostname.parse("fabian-gce-eu-04-dev"), "fabian", "eu", "04", "dev");
|
||||
assertServerName(hostname.parse("newclient-gce-eu-prod-d4fg"), "newclient", "eu", "d4fg", "prod");
|
||||
assertServerName(hostname.parse("ide-old-gce-usw-02-prod"), "ide-old", "usw", "02", "prod");
|
||||
assertServerName(hostname.parse("fabian-gce-eu-04-dev"), "fabian", "gce", "eu", "04", "dev");
|
||||
assertServerName(hostname.parse("newclient-gce-eu-prod-d4fg"), "newclient", "gce", "eu", "d4fg", "prod");
|
||||
assertServerName(hostname.parse("ide-old-gce-usw-02-prod"), "ide-old", "gce", "usw", "02", "prod");
|
||||
assertServerName(hostname.parse("docker-premium-eu-115-prod"), "docker", "premium", "eu", "115", "prod");
|
||||
});
|
||||
});
|
||||
|
|
Ładowanie…
Reference in New Issue