fix: clean up service configuration startup and development commands

This commit is contained in:
Boki 2026-10-26 13:23:49 -04:00
parent 4ddffa6b67
commit 805a9f8fd4
36 changed files with 627 additions and 596 deletions

View file

@ -85,7 +85,7 @@ export class ServiceContainerBuilder {
return appConfigSchema.parse(finalConfig);
}
private applyServiceOptions(config: Partial<AppConfig>): AppConfig {
private applyServiceOptions(config: Partial<AppConfig>) {
// Ensure questdb config has the right field names for DI
const questdbConfig = config.questdb
? {
@ -102,24 +102,33 @@ export class ServiceContainerBuilder {
};
return {
redis: config.redis || {
enabled: this.options.enableCache ?? true,
host: 'localhost',
port: 6379,
db: 0,
redis: {
...(config.redis || {
enabled: this.options.enableCache ?? true,
host: 'localhost',
port: 6379,
db: 0,
}),
enabled: this.options.enableCache !== false && (config.redis?.enabled ?? true),
},
mongodb: config.mongodb || {
enabled: this.options.enableMongoDB ?? true,
uri: '',
database: '',
mongodb: {
...(config.mongodb || {
enabled: this.options.enableMongoDB ?? true,
uri: '',
database: '',
}),
enabled: this.options.enableMongoDB !== false && (config.mongodb?.enabled ?? true),
},
postgres: config.postgres || {
enabled: this.options.enablePostgres ?? true,
host: 'localhost',
port: 5432,
database: 'postgres',
user: 'postgres',
password: 'postgres',
postgres: {
...(config.postgres || {
enabled: this.options.enablePostgres ?? true,
host: 'localhost',
port: 5432,
database: 'postgres',
user: 'postgres',
password: 'postgres',
}),
enabled: this.options.enablePostgres !== false && (config.postgres?.enabled ?? true),
},
questdb: this.options.enableQuestDB ? questdbConfig : undefined,
proxy: this.options.enableProxy
@ -196,19 +205,10 @@ export class ServiceContainerBuilder {
}
private transformStockBotConfig(config: UnifiedAppConfig): Partial<AppConfig> {
// Unified config already has flat structure, just extract what we need
// Handle questdb field name mapping
// Keep the schema-normalized values intact; only the legacy port name
// differs at this adapter boundary.
const questdb = config.questdb
? {
enabled: config.questdb.enabled ?? true,
host: config.questdb.host || 'localhost',
httpPort: config.questdb.httpPort || 9000,
pgPort: config.questdb.pgPort || 8812,
influxPort: getInfluxPort(config.questdb),
database: config.questdb.database || 'questdb',
user: config.questdb.user,
password: config.questdb.password,
}
? { ...config.questdb, influxPort: getInfluxPort(config.questdb) }
: undefined;
return {