File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
packages/server/src/templates Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,16 @@ export const generateRandomDomain = ({
3737 const hash = randomBytes ( 3 ) . toString ( "hex" ) ;
3838 const slugIp = serverIp . replaceAll ( "." , "-" ) . replaceAll ( ":" , "-" ) ;
3939
40- return `${ projectName } -${ hash } ${ slugIp === "" ? "" : `-${ slugIp } ` } .traefik.me` ;
40+ // Domain labels have a max length of 63 characters
41+ // Reserve space for: hash (6) + separators (1-2) + ip section + dot + traefik.me (10)
42+ // Approx: 6 + 2 + (variable ip length) + 11 = ~19-30 chars for other parts
43+ const maxProjectNameLength = 40 ;
44+ const truncatedProjectName =
45+ projectName . length > maxProjectNameLength
46+ ? projectName . substring ( 0 , maxProjectNameLength )
47+ : projectName ;
48+
49+ return `${ truncatedProjectName } -${ hash } ${ slugIp === "" ? "" : `-${ slugIp } ` } .traefik.me` ;
4150} ;
4251
4352export const generateHash = ( length = 8 ) : string => {
You can’t perform that action at this time.
0 commit comments