lab7: live stand integration fixes and verified evidence

This commit is contained in:
2026-11-26 19:17:22 +03:00
parent 33cec9bb7a
commit 210d645e28
47 changed files with 50612 additions and 80 deletions
+4 -3
View File
@@ -95,9 +95,10 @@ describe('BrokerClient least-privilege consumer & producer modes', () => {
port: 5671,
vhost: 'messenger',
});
expect((target as { credentials?: { mechanism?: string } }).credentials?.mechanism).toBe(
'EXTERNAL',
);
expect(
(sockOpts as { credentials?: { mechanism?: string } })?.credentials
?.mechanism,
).toBe('EXTERNAL');
expect(sockOpts).toMatchObject({
servername: 'broker',
rejectUnauthorized: true,
+6 -2
View File
@@ -97,6 +97,8 @@ export type AmqpConnectFn = (
socketOptions?: unknown,
) => Promise<ChannelModel>;
const AMQP_CONNECT_OVERRIDE = Symbol('AMQP_CONNECT_OVERRIDE');
@Injectable()
export class BrokerClient implements OnModuleDestroy {
private readonly logger = new Logger(BrokerClient.name);
@@ -133,7 +135,7 @@ export class BrokerClient implements OnModuleDestroy {
private readonly metrics: MetricsService,
@Optional() @Inject(TlsMaterialManager) private readonly tls?: TlsMaterialManager,
@Optional() @Inject(RuntimeSecretsStore) private readonly secrets?: RuntimeSecretsStore,
connectOverride?: AmqpConnectFn,
@Optional() @Inject(AMQP_CONNECT_OVERRIDE) connectOverride?: AmqpConnectFn,
) {
const getOpt = <K extends keyof AppConfig>(key: K): AppConfig[K] | undefined =>
typeof config.get === 'function' ? config.get(key) : undefined;
@@ -435,9 +437,11 @@ export class BrokerClient implements OnModuleDestroy {
hostname: this.host,
port: this.port,
vhost: this.vhost,
},
socketOptions: {
...socketOptions,
credentials: amqpCredentials.external(),
},
socketOptions,
};
}
const creds = this.secrets?.getBrokerCredentials();