Skip to content

Commit

Permalink
feat(plugin-clickhouse): update lifecycle
Browse files Browse the repository at this point in the history
  • Loading branch information
thonatos committed Oct 8, 2024
1 parent abdea30 commit f869f2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/plugins/clickhouse/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type ClickHouseConfig = NodeClickHouseClientConfigOptions & {
id: InjectEnum.Client,
scope: ScopeEnum.SINGLETON,
})
export class ClickHouseClient {
export default class ClickHouseClient {
_config: any;

private clickhouseClient: NodeClickHouseClient;
Expand All @@ -34,4 +34,4 @@ export class ClickHouseClient {
}
}

export default ClickHouseClient;
export { ClickHouseClient };
3 changes: 2 additions & 1 deletion packages/plugins/clickhouse/src/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
LifecycleHook,
} from '@artus/core';
import { ClickHouseConfig, ClickHouseClient } from './client';
import { InjectEnum } from './constants';

@LifecycleHookUnit()
export default class PluginLifecycle implements ApplicationLifecycle {
Expand All @@ -26,7 +27,7 @@ export default class PluginLifecycle implements ApplicationLifecycle {
}

this.logger.info('[clickhouse] staring clickhouse with url: %s', config.url);
const clickhouse = this.app.container.get('ARTUSX_CLICKHOUSE') as ClickHouseClient;
const clickhouse = this.app.container.get(InjectEnum.Client) as ClickHouseClient;
await clickhouse.init(config);
}
}

0 comments on commit f869f2b

Please sign in to comment.