2121 */
2222
2323import java .io .File ;
24- import java .io .FileInputStream ;
2524import java .io .IOException ;
2625import java .io .InputStream ;
26+ import java .nio .file .Files ;
2727import java .util .Properties ;
2828
2929import de .taimos .daemon .DaemonStarter ;
@@ -73,32 +73,25 @@ public CloudConductorPropertyProvider(String server, String template, String tok
7373 }
7474
7575 private void checkSecureConnections () {
76- String secureConnection = CloudConductorPropertyProvider .getProperty (CloudConductorPropertyProvider .CLOUDCONDUCTOR_SECURE_CONNECTIONS );
77- if (Boolean . parseBoolean ( secureConnection )) {
78- this . setProtocol (CloudConductorPropertyProvider .HTTPS );
76+ String secureConnection = System .getProperty (CloudConductorPropertyProvider .CLOUDCONDUCTOR_SECURE_CONNECTIONS );
77+ if (secureConnection == null ) {
78+ secureConnection = System . getenv (CloudConductorPropertyProvider .CLOUDCONDUCTOR_SECURE_CONNECTIONS );
7979 }
80- }
81-
82- private static String getProperty (String name ) {
83- String property = System .getProperty (name );
84- if (property == null ) {
85- property = System .getenv (name );
80+ if (Boolean .parseBoolean (secureConnection )) {
81+ this .setProtocol (CloudConductorPropertyProvider .HTTPS );
8682 }
87- return property ;
8883 }
8984
90- /**
91- * @param protocol http or https, http is default;
92- * @return this provider
93- */
94- public CloudConductorPropertyProvider setProtocol (String protocol ) {
85+ /**
86+ * @param protocol http or https, http is default;
87+ */
88+ public void setProtocol (String protocol ) {
9589 if (protocol .equalsIgnoreCase (CloudConductorPropertyProvider .HTTPS )) {
9690 this .protocol = CloudConductorPropertyProvider .HTTPS ;
9791 } else {
9892 this .protocol = "http" ;
9993 }
100- return this ;
101- }
94+ }
10295
10396 @ Override
10497 protected String getDescription () {
@@ -113,7 +106,12 @@ protected HTTPResponse getResponse() {
113106 if (this .jwt != null ) {
114107 req .authBearer (this .jwt );
115108 }
116- return req .get ();
109+ HTTPResponse httpResponse = req .get ();
110+ int status = httpResponse .getStatus ();
111+ if (200 > status || 300 < status ) {
112+ this .logger .warn ("Config request with CloudConductor Server {} failed with status {}" , this .server , status );
113+ }
114+ return httpResponse ;
117115 }
118116
119117 private void readPropertyFile (String propFile ) {
@@ -125,7 +123,7 @@ private void readPropertyFile(String propFile) {
125123 file = new File (CloudConductorPropertyProvider .CLOUDCONDUCTOR_PROP_FILE_DEFAULT_PATH );
126124 }
127125 if (file .exists ()) {
128- try (InputStream reader = new FileInputStream (file )) {
126+ try (InputStream reader = Files . newInputStream (file . toPath () )) {
129127 Properties prop = new Properties ();
130128 prop .load (reader );
131129 if (this .server == null && prop .containsKey (CloudConductorPropertyProvider .CLOUDCONDUCTOR_URL )) {
0 commit comments