Skip to content

Commit 3af7846

Browse files
committed
chore: ImageKit Configuration class added
1 parent c70634b commit 3af7846

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package io.imagekit.sdk.config;
2+
3+
/**
4+
* Configuration class contains sdk configuration
5+
*/
6+
public class Configuration {
7+
private String publicKey;
8+
private String privateKey;
9+
private String urlEndpoint;
10+
11+
public Configuration() {
12+
13+
}
14+
15+
public Configuration(String publicKey, String privateKey, String urlEndpoint) {
16+
this.publicKey = publicKey;
17+
this.privateKey = privateKey;
18+
this.urlEndpoint = urlEndpoint;
19+
}
20+
21+
public String getPublicKey() {
22+
return publicKey;
23+
}
24+
25+
public void setPublicKey(String publicKey) {
26+
this.publicKey = publicKey;
27+
}
28+
29+
public String getPrivateKey() {
30+
return privateKey;
31+
}
32+
33+
public void setPrivateKey(String privateKey) {
34+
this.privateKey = privateKey;
35+
}
36+
37+
public String getUrlEndpoint() {
38+
return urlEndpoint;
39+
}
40+
41+
public void setUrlEndpoint(String urlEndpoint) {
42+
this.urlEndpoint = urlEndpoint;
43+
}
44+
45+
@Override
46+
public String toString() {
47+
return "Configuration{" +
48+
"publicKey='" + publicKey + '\'' +
49+
", privateKey='" + privateKey + '\'' +
50+
", urlEndpoint='" + urlEndpoint + '\'' +
51+
'}';
52+
}
53+
54+
public boolean validate(){
55+
if (urlEndpoint==null){
56+
throw new RuntimeException("UrlEndpoint not found in config.properties");
57+
}
58+
if (privateKey==null){
59+
throw new RuntimeException("PrivateKey not found in config.properties");
60+
}
61+
if (publicKey==null){
62+
throw new RuntimeException("PublicKey not found in config.properties");
63+
}
64+
return true;
65+
}
66+
}

0 commit comments

Comments
 (0)