Use java system properties to find the user's home directory before looking to ENV properties.
This commit is contained in:
@ -12,10 +12,15 @@ public class ConfigWrapper {
|
||||
|
||||
public ConfigWrapper() {
|
||||
if (env.WDIWTLT_CONFIG_FILE) {
|
||||
if (tryLoadConfigFile(new File(env.WDIWTLT_CONFIG_FILE))) {
|
||||
if (tryLoadConfigFile(env.WDIWTLT_CONFIG_FILE)) {
|
||||
return } }
|
||||
|
||||
if (tryLoadConfigFile(new File(env.HOME, ".wdiwtlt.properties"))) return
|
||||
if (env.HOME &&
|
||||
tryLoadConfigFile(new File(env.HOME, ".wdiwtlt.properties"))) return
|
||||
|
||||
String userHome = System.getProperty('user.home')
|
||||
if (userHome &&
|
||||
tryLoadConfigFile(new File(userHome, '.wdiwtlt.properties'))) return
|
||||
|
||||
try {
|
||||
ConfigWrapper.getResourceAsStream("/com/jdbernard/wdiwtlt/db/default.properties")
|
||||
@ -68,6 +73,10 @@ public class ConfigWrapper {
|
||||
if (props) return new HikariConfig(props)
|
||||
else return null }
|
||||
|
||||
private boolean tryLoadConfigFile(String configFilePath) {
|
||||
if (!configFilePath) return false
|
||||
return tryLoadConfigFile(new File(configFilePath)) }
|
||||
|
||||
private boolean tryLoadConfigFile(File configFile) {
|
||||
if (!configFile.exists() || !configFile.isFile()) return false
|
||||
|
||||
|
Reference in New Issue
Block a user