mirror of
https://github.com/certd/certd.git
synced 2026-05-16 21:27:34 +08:00
chore: 目录调整,controller转移到外部单独的目录
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { Config, Configuration, Logger } from '@midwayjs/core';
|
||||
import { ILogger } from '@midwayjs/logger';
|
||||
import { IMidwayContainer } from '@midwayjs/core';
|
||||
import { Cron } from './cron.js';
|
||||
|
||||
// ... (see below) ...
|
||||
@Configuration({
|
||||
namespace: 'cron',
|
||||
//importConfigs: [join(__dirname, './config')],
|
||||
})
|
||||
export class CronConfiguration {
|
||||
@Config()
|
||||
config;
|
||||
@Logger()
|
||||
logger: ILogger;
|
||||
|
||||
cron: Cron;
|
||||
async onReady(container: IMidwayContainer) {
|
||||
this.logger.info('cron start');
|
||||
this.cron = new Cron({
|
||||
logger: this.logger,
|
||||
...this.config,
|
||||
});
|
||||
container.registerObject('cron', this.cron);
|
||||
this.cron.start();
|
||||
this.logger.info('cron started');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user