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 configurations in DropWizard?
ConfigurationSourceProvider
is your answer.
bootstrap.setConfigurationSourceProvider(new MyMultipleConfigurationSourceProvider());
The following is how dropwizard does it by default. You can easily change it to your own liking.
public class FileConfigurationSourceProvider implements ConfigurationSourceProvider {
@Override
public InputStream open(String path) throws IOException {
final File file = new File(path);
if (!file.exists()) {
throw new FileNotFoundException("File " + file + " not found");
}
return new FileInputStream(file);
}
}