mirror of
https://github.com/status-im/libp2p-test-plans.git
synced 2025-01-28 23:55:16 +00:00
Sanitize name before saving to compose file (#164)
This commit is contained in:
parent
9c67a406a5
commit
c30c1c429f
@ -33,7 +33,9 @@ export async function run(namespace: string, compose: ComposeSpecification, opts
|
||||
await fs.mkdir(dir, { recursive: true })
|
||||
|
||||
// Create compose.yaml file
|
||||
await fs.writeFile(path.join(dir, "compose.yaml"), stringify(compose))
|
||||
// Some docker compose environments don't like the name field to have special characters
|
||||
const sanitizedComposeName = compose?.name.replace(/[^a-zA-Z0-9_-]/g, "_")
|
||||
await fs.writeFile(path.join(dir, "compose.yaml"), stringify({...compose, name: sanitizedComposeName}))
|
||||
|
||||
const upFlags: Array<string> = []
|
||||
if (opts.up.exitCodeFrom) {
|
||||
@ -66,4 +68,4 @@ export async function run(namespace: string, compose: ComposeSpecification, opts
|
||||
}
|
||||
await fs.rm(dir, { recursive: true, force: true })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user