@adonis-agora/media
Version:
Media-library for AdonisJS — owner collections (MIME whitelist, single-file replace, ordering), image conversions (eager/lazy), pluggable content transformers (HLS video via mediabunny, metadata probe, image blur-up placeholder), and column attachments, a
38 lines • 2.12 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { BaseCommand, flags } from '@adonisjs/core/ace';
import { appKeyOf, consoleCommandKeys } from '../src/federation/redis_channel.js';
/**
* `node ace media:console-key` — print this app's console-command public key: what another app's
* federated console sets as `controlPlane.publicKey` to send commands in token mode (authkit). It is
* derived from `APP_KEY` and `consoleCommands.prefix`, so it changes when either does. Not secret.
*/
export default class MediaConsoleKey extends BaseCommand {
static commandName = 'media:console-key';
static description = "Print this app's console-command public key (the federated console's controlPlane.publicKey)";
static options = { startApp: false };
async run() {
const options = this.app.config.get('media', {}).consoleCommands;
const prefix = this.prefix ?? options?.prefix;
if (!prefix) {
this.logger.error('No prefix: set consoleCommands.prefix in config/media.ts, or pass --prefix');
this.exitCode = 1;
return;
}
const appKey = await appKeyOf(this.app);
if (!appKey) {
this.logger.error('No APP_KEY: the console-command key is derived from it');
this.exitCode = 1;
return;
}
this.logger.log(consoleCommandKeys(appKey, prefix).publicKey);
}
}
__decorate([
flags.string({ description: 'The channel prefix (default: consoleCommands.prefix)' })
], MediaConsoleKey.prototype, "prefix", void 0);
//# sourceMappingURL=console_key.js.map