kopia lustrzana https://github.com/c9/core
31 wiersze
988 B
JavaScript
31 wiersze
988 B
JavaScript
|
|
var dockerHelpers = {
|
|
getUsernameFromContainerName: function (containerName) {
|
|
if (containerName.split("-").length < 3) return "";
|
|
return containerName.replace(/^container-/, "")
|
|
.replace(/-[a-zA-Z]+$/, "")
|
|
.replace(/-[0-9]+$/, "")
|
|
.split("-")[0];
|
|
},
|
|
|
|
getProjectNameFromContainerName: function (containerName) {
|
|
if (containerName.split("-").length < 3) return "";
|
|
return containerName.replace(/^container-/, "")
|
|
.replace(/-[a-zA-Z]+$/, "")
|
|
.replace(/-[0-9]+$/, "")
|
|
.split("-")
|
|
.splice(1)
|
|
.join("-");
|
|
},
|
|
|
|
getProjectIdFromContainerName: function (containerName) {
|
|
if (containerName.split("-").length < 3) return "";
|
|
return containerName.replace(/^container-/, "")
|
|
.replace(/-[a-zA-Z]+$/, "")
|
|
.split("-")
|
|
.splice(-1)
|
|
.join("-");
|
|
}
|
|
}
|
|
|
|
module.exports = dockerHelpers; |