diff --git a/plugins/discovery-azure/src/main/java/org/elasticsearch/cloud/azure/AzureDiscoveryModule.java b/plugins/discovery-azure/src/main/java/org/elasticsearch/cloud/azure/AzureDiscoveryModule.java index e8af50afe23..5c6102a7f9c 100644 --- a/plugins/discovery-azure/src/main/java/org/elasticsearch/cloud/azure/AzureDiscoveryModule.java +++ b/plugins/discovery-azure/src/main/java/org/elasticsearch/cloud/azure/AzureDiscoveryModule.java @@ -59,8 +59,6 @@ public class AzureDiscoveryModule extends AbstractModule { @Override protected void configure() { logger.debug("starting azure services"); - bind(AzureComputeSettingsFilter.class).asEagerSingleton(); - // If we have set discovery to azure, let's start the azure compute service if (isDiscoveryReady(settings, logger)) { logger.debug("starting azure discovery service"); diff --git a/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java b/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java index 51dfd55b7b0..3c300e47722 100644 --- a/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java +++ b/plugins/discovery-ec2/src/main/java/org/elasticsearch/cloud/aws/AwsEc2ServiceImpl.java @@ -43,7 +43,6 @@ import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.settings.SettingsFilter; import java.util.Locale; import java.util.Random; @@ -58,15 +57,8 @@ public class AwsEc2ServiceImpl extends AbstractLifecycleComponent private AmazonEC2Client client; @Inject - public AwsEc2ServiceImpl(Settings settings, SettingsFilter settingsFilter, NetworkService networkService, DiscoveryNodeService discoveryNodeService) { + public AwsEc2ServiceImpl(Settings settings, NetworkService networkService, DiscoveryNodeService discoveryNodeService) { super(settings); - // Filter global settings - settingsFilter.addFilter(CLOUD_AWS.KEY); - settingsFilter.addFilter(CLOUD_AWS.SECRET); - settingsFilter.addFilter(CLOUD_AWS.PROXY_PASSWORD); - settingsFilter.addFilter(CLOUD_EC2.KEY); - settingsFilter.addFilter(CLOUD_EC2.SECRET); - settingsFilter.addFilter(CLOUD_EC2.PROXY_PASSWORD); // add specific ec2 name resolver networkService.addCustomNameResolver(new Ec2NameResolver(settings)); discoveryNodeService.addCustomAttributeProvider(new Ec2CustomNodeAttributes(settings)); diff --git a/plugins/discovery-ec2/src/main/java/org/elasticsearch/plugin/discovery/ec2/Ec2DiscoveryPlugin.java b/plugins/discovery-ec2/src/main/java/org/elasticsearch/plugin/discovery/ec2/Ec2DiscoveryPlugin.java index 3b3d206c255..42f4fbbf336 100644 --- a/plugins/discovery-ec2/src/main/java/org/elasticsearch/plugin/discovery/ec2/Ec2DiscoveryPlugin.java +++ b/plugins/discovery-ec2/src/main/java/org/elasticsearch/plugin/discovery/ec2/Ec2DiscoveryPlugin.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.Collection; import org.elasticsearch.SpecialPermission; +import org.elasticsearch.cloud.aws.AwsEc2Service; import org.elasticsearch.cloud.aws.AwsEc2ServiceImpl; import org.elasticsearch.cloud.aws.Ec2Module; import org.elasticsearch.common.component.LifecycleComponent; @@ -32,6 +33,7 @@ import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.SettingsModule; import org.elasticsearch.discovery.DiscoveryModule; import org.elasticsearch.discovery.ec2.AwsEc2UnicastHostsProvider; import org.elasticsearch.discovery.ec2.Ec2Discovery; @@ -100,4 +102,14 @@ public class Ec2DiscoveryPlugin extends Plugin { discoveryModule.addUnicastHostProvider(AwsEc2UnicastHostsProvider.class); } } + + 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); + } }