Watcher: Fix HTTP proxy port setting (elastic/elasticsearch#2961)

The value of the setting name had a typo.
Also added a message to show the value of globally configured proxy on startup
to help admins spot if this is configured.

Original commit: elastic/x-pack-elasticsearch@bdc41ff733
This commit is contained in:
Alexander Reelsen 2016-07-28 16:10:02 +02:00 committed by GitHub
parent ba1ced9096
commit 39d614bd17
1 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,6 @@ import org.elasticsearch.ElasticsearchTimeoutException;
import org.elasticsearch.SpecialPermission; import org.elasticsearch.SpecialPermission;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.component.AbstractLifecycleComponent;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.io.Streams;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
@ -69,7 +68,7 @@ public class HttpClient extends AbstractLifecycleComponent {
public static final String SETTINGS_SSL_TRUSTSTORE_ALGORITHM = SETTINGS_SSL_PREFIX + "truststore.algorithm"; public static final String SETTINGS_SSL_TRUSTSTORE_ALGORITHM = SETTINGS_SSL_PREFIX + "truststore.algorithm";
static final String SETTINGS_SSL_SECURITY_TRUSTSTORE_ALGORITHM = SETTINGS_SSL_SECURITY_PREFIX + "truststore.algorithm"; static final String SETTINGS_SSL_SECURITY_TRUSTSTORE_ALGORITHM = SETTINGS_SSL_SECURITY_PREFIX + "truststore.algorithm";
public static final String SETTINGS_PROXY_HOST = SETTINGS_PROXY_PREFIX + "host"; public static final String SETTINGS_PROXY_HOST = SETTINGS_PROXY_PREFIX + "host";
public static final String SETTINGS_PROXY_PORT = SETTINGS_PROXY_PREFIX + "post"; public static final String SETTINGS_PROXY_PORT = SETTINGS_PROXY_PREFIX + "port";
private final HttpAuthRegistry httpAuthRegistry; private final HttpAuthRegistry httpAuthRegistry;
private final Environment env; private final Environment env;
@ -93,6 +92,7 @@ public class HttpClient extends AbstractLifecycleComponent {
String proxyHost = settings.get(SETTINGS_PROXY_HOST, null); String proxyHost = settings.get(SETTINGS_PROXY_HOST, null);
if (proxyPort != null && Strings.hasText(proxyHost)) { if (proxyPort != null && Strings.hasText(proxyHost)) {
proxy = new HttpProxy(proxyHost, proxyPort); proxy = new HttpProxy(proxyHost, proxyPort);
logger.info("Using default proxy for http input and slack/hipchat/pagerduty/webhook actions [{}:{}]", proxyHost, proxyPort);
} else { } else {
if (proxyPort == null && Strings.hasText(proxyHost) || proxyPort != null && !Strings.hasText(proxyHost)) { if (proxyPort == null && Strings.hasText(proxyHost) || proxyPort != null && !Strings.hasText(proxyHost)) {
logger.error("disabling proxy. Watcher HTTP HttpProxy requires both settings: [{}] and [{}]", SETTINGS_PROXY_HOST, logger.error("disabling proxy. Watcher HTTP HttpProxy requires both settings: [{}] and [{}]", SETTINGS_PROXY_HOST,