forked from box/mojito
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I18N-1384: Add proxy functionality to CLI
* Create service to perform proxy health check * Create configuration POJO for proxy details * Use proxy configuration if enabled. * If the proxy is not healthy, default to direct access
- Loading branch information
1 parent
6040d66
commit 1a3dcb6
Showing
10 changed files
with
463 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
restclient/src/main/java/com/box/l10n/mojito/rest/resttemplate/ProxyConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.box.l10n.mojito.rest.resttemplate; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class ProxyConfig { | ||
|
||
@Value("${l10n.proxy.host:}") | ||
String host; | ||
|
||
@Value("${l10n.proxy.scheme:http}") | ||
String scheme; | ||
|
||
@Value("${l10n.proxy.port:19193}") | ||
Integer port; | ||
|
||
public String getHost() { | ||
return host; | ||
} | ||
|
||
public void setHost(String host) { | ||
this.host = host; | ||
} | ||
|
||
public String getScheme() { | ||
return scheme; | ||
} | ||
|
||
public void setScheme(String scheme) { | ||
this.scheme = scheme; | ||
} | ||
|
||
public Integer getPort() { | ||
return port; | ||
} | ||
|
||
public void setPort(Integer port) { | ||
this.port = port; | ||
} | ||
|
||
public boolean isValidConfiguration() { | ||
return this.host != null | ||
&& this.scheme != null | ||
&& this.port != null | ||
&& !this.host.isEmpty() | ||
&& !this.scheme.isEmpty() | ||
&& this.port > 0; | ||
} | ||
} |
Oops, something went wrong.