Пример #1
0
 /**
  * @inheritdoc
  */
 public function bootstrap($app)
 {
     Yii::setAlias('@psesd/sensorHub', __DIR__);
     $app->registerMigrationAlias('@psesd/sensorHub/migrations');
     Event::on(Application::className(), BroadcasterModule::EVENT_COLLECT_EVENT_TYPES, [$this, 'collectEventTypes']);
     Event::on(Application::className(), BroadcasterModule::EVENT_COLLECT_EVENT_HANDLERS, [$this, 'collectEventHandlers']);
     $localKeyProvider = Yii::createObject(['class' => LocalProvider::class, 'id' => 'local']);
     $defaultKeyPairId = 'default-token-factory';
     $provider = Yii::$app->keyProviders->getProvider('local');
     if (!($keyPair = $provider->get($defaultKeyPairId))) {
         $keyPair = $provider->generate($defaultKeyPairId);
     }
     // \d($keyPair);exit;
     $keyPairReference = $provider->getReference($keyPair);
     Yii::$app->tokenFactory->defaultKeyPair = $keyPairReference;
     //    Event::on(Cron::className(), Cron::EVENT_MIDNIGHT, [Engine::className(), 'backupInstances']);
     //    Event::on(Cron::className(), Cron::EVENT_MIDNIGHT, [Engine::className(), 'cleanBackups']);
     //    Event::on(Cron::className(), Cron::EVENT_MIDNIGHT, [Engine::className(), 'cleanVolumes']);
     //    Event::on(Cron::className(), Cron::EVENT_MORNING, [Engine::className(), 'cloudifyBackups']);
     //    Event::on(TickDaemon::className(), TickDaemon::EVENT_TICK, [Engine::className(), 'checkSensors']);
     //    Event::on(TickDaemon::className(), TickDaemon::EVENT_TICK, [Engine::className(), 'ensureCertificates']);
     //    Event::on(TickDaemon::className(), TickDaemon::EVENT_TICK, [Engine::className(), 'collectBackups']);
     Event::on(Daemon::className(), Daemon::EVENT_REGISTER_DAEMONS, [$this, 'registerDaemon']);
 }