示例#1
0
    def testGetPluginConfigFromRedis(self):
        """
        测试从redis中加载配置,方便测试初始化redis
        :return: 
        """
        from api.service.redis_service import RedisService

        RedisService.init_plugin_config()

        plugin_config = RedisPluginConfig()
        print(plugin_config)
        result = plugin_config.get_plugin_config()
        print(result)
示例#2
0
def init_plugin_info():
    """
    初始化插件信息到数据库中
    :return: 
    """
    # 初始化redis配置信息
    RedisService.init_plugin_config()
    for checker_name, checker_instance in load_default_checkers().items():
        if PluginInfoService.count(
                where=(PluginInfo.plugin_name == checker_name)) == 0:
            PluginInfoService.save(
                author=checker_instance.info["author"],
                plugin_name=checker_instance.info["name"],
                plugin_tag=checker_instance.info["tag"],
                imp_version=checker_instance.info["imp_version"],
                description=checker_instance.info["description"],
                repair=checker_instance.info["repair"],
                type=checker_instance.info["type"]["fullname"],
                chinese_type=checker_instance.info["type"]["fullchinesename"],
                level=checker_instance.info["type"]["level"],
            )