-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathCredentialsHelper.java
More file actions
25 lines (21 loc) · 863 Bytes
/
CredentialsHelper.java
File metadata and controls
25 lines (21 loc) · 863 Bytes
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
package dev.andstuff.kraken.example.helper;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import dev.andstuff.kraken.api.rest.KrakenCredentials;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class CredentialsHelper {
public static KrakenCredentials readFromFile(String path) {
try {
InputStream stream = CredentialsHelper.class.getResourceAsStream(path);
Properties properties = new Properties();
properties.load(stream);
return new KrakenCredentials(properties.getProperty("key"), properties.getProperty("secret"));
}
catch (IOException e) {
throw new IllegalStateException("Could not read properties from file: %s".formatted(path), e);
}
}
}