I want to have several yaml files for DropWizard. One of them contain sensitive info and one non sensitive.
Can you point me to any docs or example how to have multiple
Firstly, you will write another yml file path in a .yml
.
sample.yml
configPath: /another.yml
another.yml
greet: Hello!
and you will be solved by simply using the SnakeYaml.
public void run(SampleConfiguration configuration, Environment environment) {
Yaml yaml = new Yaml();
InputStream in = getClass().getResourceAsStream(configuration.getConfigPath());
AnotherConfig anotherConfig = yaml.loadAs(in, AnotherConfig.class);
String str = anotherConfig.getGreet(); // Hello!
...
}
For sensitive information, I think it is good to use the environment variable.
For example, use dropwizard-environment-config
https://github.com/tkrille/dropwizard-environment-config