public static void append()

in edas-demo/config-demo/apollo-migration/src/main/java/com/alibabacloud/edas/tool/model/ConfigPathList.java [90:117]


    public static void append(Path path) {
        String pathName = path.toString();
        Matcher m = DirNamePattern.matcher(pathName);

        if (! m.matches()) {
            System.out.println("Ignore unmatched path: " + pathName);
            return;
        }

        String appName = m.group(1);

        // 如果应用名是配置好的 共享配置,则每一项对应一个单独的配置。否则一个应用下所有内容会 Merge 成一份。
        boolean isSharedConfig = SharedConfigs.contains(appName) ;
        String key = isSharedConfig ? pathName : appName;

        // 共享配置忽略 "application.properties"
        if (isSharedConfig && pathName.endsWith("application.properties")) {
            return;
        }

        ConfigPathList configPath = ROOT.get(key);
        if (configPath == null) {
            configPath = new ConfigPathList(appName, isSharedConfig);
            ROOT.put(key, configPath);
        }

        configPath.paths.add(path);
    }