1
0
Fork 0

typo fix and port check

master
Matthew 2022-03-01 12:18:56 -05:00
parent b3f9abf692
commit d62e8846a4
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 2 additions and 1 deletions

View File

@ -14,7 +14,7 @@ export default class CWG_SelfService extends Command {
this.name = 'selfserv'; 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.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.usage = `${this.client.config.prefix}cwg selfserv <desired subdomain> <authentication token>`;
this.aliases = ['bind']; this.aliases = ['ss'];
this.enabled = true; this.enabled = true;
this.urlRegex = /^[a-zA-Z0-9\-._~:/?#[\]@!$&'()*+,;=]+$/; this.urlRegex = /^[a-zA-Z0-9\-._~:/?#[\]@!$&'()*+,;=]+$/;
} }
@ -107,6 +107,7 @@ export default class CWG_SelfService extends Command {
public async getPort() { public async getPort() {
const port = Number(await this.client.redis.get('cwgsspc')); const port = Number(await this.client.redis.get('cwgsspc'));
if (await this.client.db.Domain.exists({ port })) throw new Error('Error retreiving port.'); 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'); await this.client.redis.incr('cwgsspc');
return port; return port;
} }