public BanyanDBStorageConfig loadConfig()

in oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBConfigLoader.java [45:119]


    public BanyanDBStorageConfig loadConfig() throws ModuleStartException {
        BanyanDBStorageConfig config = new BanyanDBStorageConfig();
        Reader applicationReader = null;
        try {
            applicationReader = ResourceUtils.read("bydb.yml");
        } catch (FileNotFoundException e) {
            throw new ModuleStartException("Cannot find the BanyanDB configuration file [bydb.yml].", e);
        }
        Map<String, Map<String, ?>> configMap = yaml.loadAs(applicationReader, Map.class);
        if (configMap == null) {
            return config;
        }

        Map<String, Properties> configProperties = new HashMap<>();
        configMap.forEach((part, c) -> {
            if (c != null) {
                final Properties properties = parseConfig(c);
                configProperties.put(part, properties);
            }
        });

        try {
            copyProperties(
                config.getGlobal(), configProperties.get("global"), moduleProvider.getModule().name(),
                moduleProvider.name()
            );
            Properties groups = configProperties.get("groups");
            Properties recordsNormal = (Properties) groups.get("recordsNormal");
            copyProperties(
                config.getRecordsNormal(), recordsNormal,
                moduleProvider.getModule().name(), moduleProvider.name()
            );
            copyStages(recordsNormal, config.getRecordsNormal());

            Properties recordsSupper = (Properties) groups.get("recordsSuper");
            copyProperties(
                config.getRecordsSuper(), recordsSupper,
                moduleProvider.getModule().name(), moduleProvider.name()
            );
            copyStages(recordsSupper, config.getRecordsSuper());

            Properties metricsMin = (Properties) groups.get("metricsMin");
            copyProperties(
                config.getMetricsMin(), metricsMin,
                moduleProvider.getModule().name(), moduleProvider.name()
            );
            copyStages(metricsMin, config.getMetricsMin());

            Properties metricsHour = (Properties) groups.get("metricsHour");
            copyProperties(
                config.getMetricsHour(), metricsHour,
                moduleProvider.getModule().name(), moduleProvider.name()
            );
            copyStages(metricsHour, config.getMetricsHour());

            Properties metricsDay = (Properties) groups.get("metricsDay");
            copyProperties(
                config.getMetricsDay(), metricsDay,
                moduleProvider.getModule().name(), moduleProvider.name()
            );
            copyStages(metricsDay, config.getMetricsDay());

            copyProperties(
                config.getMetadata(), (Properties) groups.get("metadata"),
                moduleProvider.getModule().name(), moduleProvider.name()
            );
            copyProperties(
                config.getProperty(), (Properties) groups.get("property"),
                moduleProvider.getModule().name(), moduleProvider.name()
            );
        } catch (IllegalAccessException e) {
            throw new ModuleStartException("Failed to load BanyanDB configuration.", e);
        }
        return config;
    }