mirror of
https://github.com/caprover/caprover
synced 2026-08-25 17:06:35 +00:00
Harden service and volume naming migration
This commit is contained in:
@@ -26,7 +26,7 @@ import isValidPath = require('is-valid-path')
|
||||
|
||||
const APP_DEFINITIONS = 'appDefinitions'
|
||||
|
||||
function isNameAllowed(name: string) {
|
||||
export function isNameAllowed(name: string) {
|
||||
const isNameFormattingOk =
|
||||
!!name &&
|
||||
name.length < 50 &&
|
||||
@@ -34,7 +34,11 @@ function isNameAllowed(name: string) {
|
||||
/[a-z0-9]$/.test(name) &&
|
||||
/^[a-z0-9\-]+$/.test(name) &&
|
||||
name.indexOf('--') < 0
|
||||
return isNameFormattingOk && ['captain', 'registry'].indexOf(name) < 0
|
||||
return (
|
||||
isNameFormattingOk &&
|
||||
['captain', 'registry'].indexOf(name) < 0 &&
|
||||
!name.startsWith('captain-')
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,6 +306,14 @@ class AppsDataStore {
|
||||
return `${appName}`
|
||||
}
|
||||
|
||||
getVolumeName(volumeName: string, isLegacyVolumeName: boolean) {
|
||||
if (isLegacyVolumeName) {
|
||||
return `${this.namepace}--${volumeName}`
|
||||
}
|
||||
|
||||
return volumeName
|
||||
}
|
||||
|
||||
getAppDefinitions() {
|
||||
const self = this
|
||||
return new Promise<IAllAppDefinitions>(function (resolve, reject) {
|
||||
|
||||
Reference in New Issue
Block a user