move turn secret generation
This commit is contained in:
+6
-2
@@ -919,8 +919,12 @@ async function startTurn(existingInfra) {
|
||||
const memory = system.getMemoryAllocation(memoryLimit);
|
||||
const realm = settings.dashboardFqdn();
|
||||
|
||||
const turnSecret = await blobs.get(blobs.ADDON_TURN_SECRET);
|
||||
if (!turnSecret) throw new BoxError(BoxError.ADDONS_ERROR, 'Turn secret is missing');
|
||||
let turnSecret = await blobs.get(blobs.ADDON_TURN_SECRET);
|
||||
if (!turnSecret) {
|
||||
debug('startTurn: generting turn secret');
|
||||
turnSecret = 'a' + crypto.randomBytes(15).toString('hex'); // prefix with a to ensure string starts with a letter
|
||||
await blobs.set(blobs.ADDON_TURN_SECRET, Buffer.from(turnSecret));
|
||||
}
|
||||
|
||||
const readOnly = !serviceConfig.recoveryMode ? '--read-only' : '';
|
||||
const cmd = serviceConfig.recoveryMode ? '/bin/bash -c \'echo "Debug mode. Sleeping" && sleep infinity\'' : '';
|
||||
|
||||
Reference in New Issue
Block a user