apply method
FR-TENANT-001, 002
Implementation
Future<TenantContext> apply(String appCode) async {
if (_source == null) {
throw TenantResolveException(
appCode,
'TenantSource not injected',
);
}
_logger.info('Resolving tenant', {'appCode': appCode});
final ctx = await _source!.resolve(appCode);
if (ctx == null) {
throw TenantResolveException(appCode, 'Tenant not found');
}
_current = ctx;
_logger.info('Tenant applied', {
'appCode': appCode,
'servers': ctx.allowedServerIds.length,
'bundles': ctx.allowedBundleIds.length,
});
return ctx;
}