almost working
This commit is contained in:
parent
a07a71d92a
commit
8165994fde
7 changed files with 64 additions and 17 deletions
|
|
@ -3,15 +3,15 @@
|
|||
* Creates a decoupled, reusable dependency injection container
|
||||
*/
|
||||
|
||||
import { createContainer, asFunction, asValue, InjectionMode, type AwilixContainer } from 'awilix';
|
||||
import { Browser } from '@stock-bot/browser';
|
||||
import { createCache, type CacheProvider } from '@stock-bot/cache';
|
||||
import { ProxyManager } from '@stock-bot/proxy';
|
||||
import type { IServiceContainer } from '@stock-bot/handlers';
|
||||
import { getLogger } from '@stock-bot/logger';
|
||||
import { createMongoDBClient } from '@stock-bot/mongodb';
|
||||
import { createPostgreSQLClient } from '@stock-bot/postgres';
|
||||
import { ProxyManager } from '@stock-bot/proxy';
|
||||
import { createQuestDBClient } from '@stock-bot/questdb';
|
||||
import { Browser } from '@stock-bot/browser';
|
||||
import type { IServiceContainer } from '@stock-bot/handlers';
|
||||
import { asFunction, asValue, createContainer, InjectionMode, type AwilixContainer } from 'awilix';
|
||||
|
||||
// Configuration types
|
||||
export interface AppConfig {
|
||||
|
|
@ -35,7 +35,10 @@ export interface AppConfig {
|
|||
};
|
||||
questdb?: {
|
||||
host: string;
|
||||
port: number;
|
||||
httpPort?: number;
|
||||
pgPort?: number;
|
||||
influxPort?: number;
|
||||
database?: string;
|
||||
};
|
||||
proxy?: {
|
||||
cachePrefix?: string;
|
||||
|
|
@ -62,7 +65,7 @@ export function createServiceContainer(config: AppConfig): AwilixContainer {
|
|||
redisConfig: asValue(config.redis),
|
||||
mongoConfig: asValue(config.mongodb),
|
||||
postgresConfig: asValue(config.postgres),
|
||||
questdbConfig: asValue(config.questdb || { host: 'localhost', port: 9009 }),
|
||||
questdbConfig: asValue(config.questdb || { host: 'localhost', httpPort: 9000, pgPort: 8812, influxPort: 9009 }),
|
||||
|
||||
// Core services with dependency injection
|
||||
logger: asFunction(() => getLogger('app')).singleton(),
|
||||
|
|
@ -119,13 +122,17 @@ export function createServiceContainer(config: AppConfig): AwilixContainer {
|
|||
}).singleton(),
|
||||
|
||||
questdbClient: asFunction(({ questdbConfig, logger }) => {
|
||||
console.log('Creating QuestDB client with config:', questdbConfig);
|
||||
return createQuestDBClient(
|
||||
{
|
||||
host: questdbConfig.host,
|
||||
httpPort: 9000,
|
||||
pgPort: questdbConfig.port || 8812,
|
||||
influxPort: 9009,
|
||||
database: 'questdb',
|
||||
httpPort: questdbConfig.httpPort,
|
||||
pgPort: questdbConfig.pgPort,
|
||||
influxPort: questdbConfig.influxPort,
|
||||
database: questdbConfig.database,
|
||||
// QuestDB appears to require default credentials
|
||||
user: 'admin',
|
||||
password: 'quest',
|
||||
},
|
||||
logger
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue