feat: implement dynamic driver configuration + fix integration test log pollution (#12104)

### Primary Changes: Dynamic Driver Configuration
Refactors FileStorageService and EmailSenderService to support dynamic
driver configuration changes at runtime without requiring application
restarts.

**Key Architectural Change**: Instead of conditionally registering
drivers at build time based on configuration, we now **register all
possible drivers eagerly** and select the appropriate one at runtime.

### What Changed:
- **Before**: Modules conditionally registered only the configured
driver (e.g., only S3Driver if STORAGE_TYPE=S3)
- **After**: All drivers (LocalDriver, S3Driver, SmtpDriver,
LoggerDriver) are registered at startup
- **Runtime Selection**: Services dynamically choose and instantiate the
correct driver based on current configuration

### Secondary Fix: Integration Test Log Cleanup
Addresses ConfigStorageService error logs appearing in integration test
output by using injected LoggerService for consistent log handling.
This commit is contained in:
nitin
2025-05-28 14:19:20 +05:30
committed by GitHub
parent d133055609
commit 1c64b7b072
31 changed files with 1432 additions and 540 deletions

View File

@ -13,4 +13,4 @@ export const TEST_KEY_METRICS: ConfigKey =
'HEALTH_METRICS_TIME_WINDOW_IN_MINUTES';
export const TEST_KEY_ENV_ONLY: ConfigKey = 'PG_DATABASE_URL';
export const TEST_KEY_NONEXISTENT = 'NONEXISTENT_CONFIG_KEY';
export const TEST_KEY_STRING_VALUE = 'EMAIL_FROM_NAME';
export const TEST_KEY_STRING_VALUE: ConfigKey = 'EMAIL_FROM_NAME';

View File

@ -257,24 +257,24 @@ describe('TwentyConfig Integration', () => {
it('should reject updating config variables with invalid types', async () => {
await createConfigVariable({
input: {
key: 'NODE_PORT',
value: 3000,
key: TEST_KEY_DEFAULT,
value: true,
},
});
const updateResult = await updateConfigVariable({
input: {
key: 'NODE_PORT',
value: 'not-a-number',
key: TEST_KEY_DEFAULT,
value: 'not-a-boolean',
},
expectToFail: true,
});
expect(updateResult.errors).toBeDefined();
expect(updateResult.errors[0].message).toContain('Expected number');
expect(updateResult.errors[0].message).toContain('Expected boolean');
await deleteConfigVariable({
input: { key: 'NODE_PORT' },
input: { key: TEST_KEY_DEFAULT },
});
});
});