kopia lustrzana https://github.com/c9/core
22 wiersze
686 B
JavaScript
22 wiersze
686 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("-");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = dockerHelpers;
|