-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRuntimeConfig.java
More file actions
56 lines (47 loc) · 1.63 KB
/
RuntimeConfig.java
File metadata and controls
56 lines (47 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//------------------------------------------------------------------
// Copyright 2020 mobile.de GmbH.
// Author/Developer: Philipp Bartsch
//
// This code is licensed under MIT license (see LICENSE for details)
//------------------------------------------------------------------
package org.example.moveclient;
import java.io.IOException;
import java.net.URL;
import java.util.Properties;
public class RuntimeConfig {
private String userName;
private String password;
private String partnerId;
private String moveBaseUrl;
public RuntimeConfig() {
ingestProperties("config.properties");
ingestProperties("untracked-config.properties");
}
private void ingestProperties(String s) {
URL resource = RuntimeConfig.class.getClassLoader().getResource(s);
if (resource != null) {
try {
Properties prop = new Properties();
prop.load(RuntimeConfig.class.getClassLoader().getResourceAsStream(s));
userName = prop.getProperty("auth.user");
password = prop.getProperty("auth.password");
partnerId = prop.getProperty("partnerId");
moveBaseUrl = prop.getProperty("moveBaseUrl");
} catch (IOException e) {
throw new IllegalStateException("Failed to read runtime props.", e);
}
}
}
public String getUserName() {
return userName;
}
public String getPassword() {
return password;
}
public String getPartnerId() {
return partnerId;
}
public String getMoveBaseUrl() {
return moveBaseUrl;
}
}