lab7: live stand integration fixes and verified evidence
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user