forked from engineering/cloudservices
typo fix and port check
parent
b3f9abf692
commit
d62e8846a4
|
@ -14,7 +14,7 @@ export default class CWG_SelfService extends Command {
|
|||
this.name = 'selfserv';
|
||||
this.description = 'Creates a subdomain on your account. Do not include the entire subdomain: if you want `mydomain.cloud.libraryofcode.org`, just supply `mydomain` in the command parameters.\nYou must receive an authentication token from the Instant Application Service, see `?apply` for more information.';
|
||||
this.usage = `${this.client.config.prefix}cwg selfserv <desired subdomain> <authentication token>`;
|
||||
this.aliases = ['bind'];
|
||||
this.aliases = ['ss'];
|
||||
this.enabled = true;
|
||||
this.urlRegex = /^[a-zA-Z0-9\-._~:/?#[\]@!$&'()*+,;=]+$/;
|
||||
}
|
||||
|
@ -107,6 +107,7 @@ export default class CWG_SelfService extends Command {
|
|||
public async getPort() {
|
||||
const port = Number(await this.client.redis.get('cwgsspc'));
|
||||
if (await this.client.db.Domain.exists({ port })) throw new Error('Error retreiving port.');
|
||||
if (port >= Number(process.env.MAX_CWG_PORT)) throw new Error('Error retrieving port.');
|
||||
await this.client.redis.incr('cwgsspc');
|
||||
return port;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue