new features
This commit is contained in:
@@ -179,6 +179,32 @@ export class DmsService {
|
||||
console.log(`[dms] password updated for mailbox: ${normalized}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the storage quota for a mailbox via the docker-mailserver
|
||||
* `setup quota set` subcommand. quotaGb must be a positive integer.
|
||||
* Equivalent to: docker exec mailserver setup quota set user@example.com 35G
|
||||
*/
|
||||
async setQuota(email: string, quotaGb: number): Promise<void> {
|
||||
const normalized = normalizeEmail(email);
|
||||
const gb = Math.floor(Number(quotaGb));
|
||||
|
||||
if (!Number.isFinite(gb) || gb <= 0 || gb > 1024) {
|
||||
throw new Error(`Invalid quota size: ${quotaGb}`);
|
||||
}
|
||||
|
||||
console.log(`[dms] setting quota for ${normalized} to ${gb}G`);
|
||||
|
||||
await this.assertDockerAccess();
|
||||
|
||||
await run(
|
||||
'docker',
|
||||
['exec', config.dmsContainer, 'setup', 'quota', 'set', normalized, `${gb}G`],
|
||||
120000,
|
||||
);
|
||||
|
||||
console.log(`[dms] quota set for ${normalized}: ${gb}G`);
|
||||
}
|
||||
|
||||
async syncSesDomain(domain: string): Promise<void> {
|
||||
const normalizedDomain = domain.toLowerCase();
|
||||
|
||||
@@ -204,4 +230,4 @@ export class DmsService {
|
||||
|
||||
return parseDoveadmQuota(stdout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user