34
34
import io .orkes .conductor .client .http .OrkesWorkflowClient ;
35
35
36
36
import lombok .extern .slf4j .Slf4j ;
37
+ import org .springframework .core .env .Environment ;
38
+
39
+ import java .net .InetSocketAddress ;
40
+ import java .net .Proxy ;
41
+ import java .net .URI ;
37
42
38
43
@ AutoConfiguration
39
44
@ Slf4j
@@ -45,7 +50,7 @@ public class OrkesConductorClientAutoConfiguration {
45
50
@ Primary
46
51
@ ConditionalOnMissingBean
47
52
public ApiClient orkesConductorClient (ClientProperties clientProperties ,
48
- OrkesClientProperties orkesClientProperties ) {
53
+ OrkesClientProperties orkesClientProperties , Environment environment ) {
49
54
var basePath = StringUtils .isBlank (clientProperties .getRootUri ()) ? clientProperties .getBasePath () : clientProperties .getRootUri ();
50
55
if (basePath == null ) {
51
56
basePath = orkesClientProperties .getConductorServerUrl ();
@@ -62,6 +67,14 @@ public ApiClient orkesConductorClient(ClientProperties clientProperties,
62
67
.writeTimeout (clientProperties .getTimeout ().getWrite ())
63
68
.verifyingSsl (clientProperties .isVerifyingSsl ());
64
69
70
+ var proxy = environment .getProperty ("CONDUCTOR_SERVER_PROXY_URL" );
71
+
72
+ if (proxy != null ) {
73
+ var uri = URI .create (proxy );
74
+ var address = new InetSocketAddress (uri .getHost (), uri .getPort () == -1 ? 80 : uri .getPort ());
75
+
76
+ builder .proxy (new Proxy (Proxy .Type .HTTP , address ));
77
+ }
65
78
66
79
if (orkesClientProperties .getKeyId () != null ) {
67
80
builder .credentials (orkesClientProperties .getKeyId (), orkesClientProperties .getSecret ());
0 commit comments