diff --git a/packages/pockethost/src/mothership-app/pb_hooks/src/instances-create.pb.js b/packages/pockethost/src/mothership-app/pb_hooks/src/instances-create.pb.js index 10abc93d..eddeecea 100644 --- a/packages/pockethost/src/mothership-app/pb_hooks/src/instances-create.pb.js +++ b/packages/pockethost/src/mothership-app/pb_hooks/src/instances-create.pb.js @@ -37,9 +37,9 @@ routerAdd( // This is necessary for destructuring to work correctly data = JSON.parse(JSON.stringify(data)) - const { subdomain } = data + const { subdomain, region } = data - log(`***vars`, JSON.stringify({ subdomain })) + log(`***vars`, JSON.stringify({ subdomain, region })) if (!subdomain) { throw new BadRequestError( @@ -50,6 +50,7 @@ routerAdd( const collection = dao.findCollectionByNameOrId('instances') const record = new Record(collection) record.set('uid', authRecord.getId()) + record.set('region', region || `sfo-1`) record.set('subdomain', subdomain) record.set('status', 'idle') record.set('version', versions[0]) diff --git a/packages/pockethost/src/mothership-app/pb_hooks/src/signup.pb.js b/packages/pockethost/src/mothership-app/pb_hooks/src/signup.pb.js index d95cc02d..4cae7322 100644 --- a/packages/pockethost/src/mothership-app/pb_hooks/src/signup.pb.js +++ b/packages/pockethost/src/mothership-app/pb_hooks/src/signup.pb.js @@ -120,6 +120,7 @@ routerAdd( const email = parsed.email?.trim() const password = parsed.password?.trim() const desiredInstanceName = parsed.instanceName?.trim() + const region = parsed.region?.trim() /** * @param {string} fieldName @@ -190,6 +191,7 @@ routerAdd( try { const instance = new Record(instanceCollection) instance.set('subdomain', desiredInstanceName) + instance.set('region', region || `sfo-1`) instance.set('uid', user.get('id')) instance.set('status', 'idle') instance.set('notifyMaintenanceMode', true)