diff options
Diffstat (limited to 'src/main/java/org')
| -rw-r--r-- | src/main/java/org/openslx/network/ProxyConfiguration.java | 1 | ||||
| -rw-r--r-- | src/main/java/org/openslx/network/ProxyProperties.java | 22 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/main/java/org/openslx/network/ProxyConfiguration.java b/src/main/java/org/openslx/network/ProxyConfiguration.java index e4956fa..748a8c0 100644 --- a/src/main/java/org/openslx/network/ProxyConfiguration.java +++ b/src/main/java/org/openslx/network/ProxyConfiguration.java @@ -27,6 +27,7 @@ public class ProxyConfiguration Authenticator.setDefault( null ); // Configuring proxy settings. First read options from config file. + ProxyProperties.load(); String proxyConfiguration = ProxyProperties.getProxyConf(); if ( proxyConfiguration.equals( "AUTO" ) || proxyConfiguration.isEmpty() ) { diff --git a/src/main/java/org/openslx/network/ProxyProperties.java b/src/main/java/org/openslx/network/ProxyProperties.java index 7e03023..71a9b24 100644 --- a/src/main/java/org/openslx/network/ProxyProperties.java +++ b/src/main/java/org/openslx/network/ProxyProperties.java @@ -18,44 +18,50 @@ public class ProxyProperties // "/opt/openslx/proxy/conf". public static String getProxyConf() { - return properties.getProperty( "PROXY_CONF" ); + return properties.getProperty( "PROXY_CONF", "" ); } public static String getProxyAddress() { - return properties.getProperty( "PROXY_ADDR" ); + return properties.getProperty( "PROXY_ADDR", "" ); } public static String getProxyUsername() { - return properties.getProperty( "PROXY_USERNAME" ); + return properties.getProperty( "PROXY_USERNAME", "" ); } public static String getProxyPassword() { - return properties.getProperty( "PROXY_PASSWORD" ); + return properties.getProperty( "PROXY_PASSWORD", "" ); } // Integers // public static int getProxyPort() { - return Util.tryToParseInt( properties.getProperty( "PROXY_PORT" ) ); + return Util.tryToParseInt( properties.getProperty( "PROXY_PORT", "0" ) ); + } + + static + { + load(); } /** * Load properties */ - static { + public static void load() + { InputStreamReader stream = null; try { + properties.clear(); // Load all entries of the config file into properties stream = new InputStreamReader( new FileInputStream( "/opt/openslx/proxy/config" ), StandardCharsets.UTF_8 ); properties.load( stream ); stream.close(); } catch ( IOException e ) { - log.error( "Could not load proxy properties from '/opt/openslx/proxy/conf'. Exiting." ); - System.exit( 2 ); + log.warn( "Could not load proxy properties from '/opt/openslx/proxy/conf'." ); } finally { Util.streamClose( stream ); } |
