cleanup
This commit is contained in:
parent
c353ddbe01
commit
ce9e2df67c
310 changed files with 2550 additions and 36861 deletions
|
|
@ -14,6 +14,16 @@ import { HandlerScanner } from '../scanner';
|
|||
import { ServiceLifecycleManager } from '../utils/lifecycle';
|
||||
import type { ContainerBuildOptions, ServiceDefinitions } from './types';
|
||||
|
||||
function extractMongoDatabaseFromUri(uri?: string): string | undefined {
|
||||
if (!uri) return undefined;
|
||||
try {
|
||||
const db = new URL(uri).pathname.replace(/^\/+/, '').split('/')[0];
|
||||
return db || undefined;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function getInfluxPort(config: { influxPort?: number; ilpPort?: number }): number {
|
||||
return config.influxPort ?? config.ilpPort ?? 9009;
|
||||
}
|
||||
|
|
@ -133,6 +143,16 @@ export class ServiceContainerBuilder {
|
|||
uri: 'mongodb://localhost:27017',
|
||||
database: '',
|
||||
}),
|
||||
...(this.options.mongoReadOnly
|
||||
? {
|
||||
uri: config.mongodb?.readUri ?? config.mongodb?.uri ?? 'mongodb://localhost:27017',
|
||||
database:
|
||||
extractMongoDatabaseFromUri(config.mongodb?.readUri) ??
|
||||
config.mongodb?.database ??
|
||||
'',
|
||||
readOnly: true,
|
||||
}
|
||||
: {}),
|
||||
enabled: this.options.enableMongoDB !== false && (config.mongodb?.enabled ?? true),
|
||||
},
|
||||
postgres: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue