Skip to content

devitcn/config-merge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Config Merge

允许你用一个yaml文件做模板,另一个yaml文件做数据,输出替换后的新yaml

  1. yaml模板内容替换
  2. 将file://application.yml 替换成实际文件内容

Build

mvn package

To Use

By Code

@Test
public void single_merge() throws Exception {

    File out = new File("target/temp");
    out.mkdirs();
    
    merge.addPath(new File("src/test/resources").toPath());
    Map<String, Object> data = merge.parseYaml(new File("case1-data.yaml"));
    Map<String, Object> template = merge.parseYaml(new File("template.yaml"));
    merge.fillTemplateWithData(template, data);
    merge.writeYamlToFile(template, new File(out, "config.yml"));
    
    System.out.println("build yaml:");
    String yamlString = merge.dump(template);
    System.out.println(yamlString);
}  

License

Apache License Version 2.0

About

通过模板和数据yaml生成configmap

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages