some plugins share settings - make it easy to filter them

This commit is contained in:
Simon Willnauer 2016-02-03 21:50:06 +01:00
parent 686627be5a
commit e1cf5e745d
3 changed files with 18 additions and 12 deletions

View File

@ -96,6 +96,12 @@ public class SettingsModule extends AbstractModule {
settingsFilterPattern.add(filter);
}
public void registerSettingsFilterIfMissing(String filter) {
if (settingsFilterPattern.contains(filter)) {
registerSettingsFilter(filter);
}
}
public void validateTribeSettings(Settings settings, ClusterSettings clusterSettings) {
Map<String, Settings> groups = settings.filter(TRIBE_CLIENT_NODE_SETTINGS_PREDICATE).getGroups("tribe.", true);

View File

@ -105,11 +105,11 @@ public class Ec2DiscoveryPlugin extends Plugin {
public void onModule(SettingsModule settingsModule) {
// Filter global settings
settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_AWS.KEY);
settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_AWS.SECRET);
settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_AWS.PROXY_PASSWORD);
settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_EC2.KEY);
settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_EC2.SECRET);
settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_EC2.PROXY_PASSWORD);
settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_AWS.KEY);
settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_AWS.SECRET);
settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_AWS.PROXY_PASSWORD);
settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_EC2.KEY);
settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_EC2.SECRET);
settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_EC2.PROXY_PASSWORD);
}
}

View File

@ -89,12 +89,12 @@ public class S3RepositoryPlugin extends Plugin {
}
public void onModule(SettingsModule module) {
module.registerSettingsFilter(AwsS3Service.CLOUD_AWS.KEY);
module.registerSettingsFilter(AwsS3Service.CLOUD_AWS.SECRET);
module.registerSettingsFilter(AwsS3Service.CLOUD_AWS.PROXY_PASSWORD);
module.registerSettingsFilter(AwsS3Service.CLOUD_S3.KEY);
module.registerSettingsFilter(AwsS3Service.CLOUD_S3.SECRET);
module.registerSettingsFilter(AwsS3Service.CLOUD_S3.PROXY_PASSWORD);
module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_AWS.KEY);
module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_AWS.SECRET);
module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_AWS.PROXY_PASSWORD);
module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_S3.KEY);
module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_S3.SECRET);
module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_S3.PROXY_PASSWORD);
module.registerSettingsFilter("access_key"); // WTF is this?
module.registerSettingsFilter("secret_key"); // WTF is this?
}