2024-05-30 03:12:56 -04:00
|
|
|
import { reconfigure } from './hostAdminClient'
|
|
|
|
|
|
|
|
let lastConfig: string
|
|
|
|
|
2024-05-30 03:13:40 -04:00
|
|
|
export function startWith({
|
|
|
|
pro = false,
|
|
|
|
version = 'latest',
|
|
|
|
vars = {},
|
|
|
|
varsFn = () => ({}),
|
2024-06-11 07:01:21 -04:00
|
|
|
withDataDir = false,
|
2024-05-30 03:13:40 -04:00
|
|
|
}) {
|
2024-05-30 03:12:56 -04:00
|
|
|
before(async function () {
|
2024-05-30 03:13:40 -04:00
|
|
|
Object.assign(vars, varsFn())
|
2024-06-11 07:01:21 -04:00
|
|
|
const cfg = JSON.stringify({ pro, version, vars, withDataDir })
|
2024-05-30 03:12:56 -04:00
|
|
|
if (lastConfig === cfg) return
|
|
|
|
|
|
|
|
this.timeout(100 * 1000)
|
2024-06-11 07:01:21 -04:00
|
|
|
await reconfigure({ pro, version, vars, withDataDir })
|
2024-05-30 03:12:56 -04:00
|
|
|
lastConfig = cfg
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export { reconfigure }
|