mirror of
https://github.com/certd/certd.git
synced 2026-05-17 13:57:31 +08:00
25 lines
599 B
TypeScript
25 lines
599 B
TypeScript
import { logger } from '@certd/basic';
|
|
import { Config, Configuration, IMidwayContainer } from '@midwayjs/core';
|
|
import { Cron } from './cron.js';
|
|
|
|
// ... (see below) ...
|
|
@Configuration({
|
|
namespace: 'cron',
|
|
//importConfigs: [join(__dirname, './config')],
|
|
})
|
|
export class CronConfiguration {
|
|
@Config()
|
|
config;
|
|
cron: Cron;
|
|
async onReady(container: IMidwayContainer) {
|
|
logger.info('cron start');
|
|
this.cron = new Cron({
|
|
logger: logger,
|
|
...this.config,
|
|
});
|
|
container.registerObject('cron', this.cron);
|
|
this.cron.start();
|
|
logger.info('cron started');
|
|
}
|
|
}
|