Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/com/jcs_java_sdk/Compute.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class Compute
private KeyPair keyPair;
private Snapshot snapshot;
private Volume volume;
public Compute()
public Compute(String endpoint, String access_key, String secret_key)
{
info = new HttpVar();
image = new Image();
Expand All @@ -117,7 +117,7 @@ public Compute()
volume = new Volume();
try
{
new Config();
new Config(endpoint, access_key, secret_key);
}
catch (IOException e)
{
Expand Down
41 changes: 15 additions & 26 deletions src/main/java/com/jcs_java_sdk/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,37 +35,26 @@ public class Config {
static String accessKey;
static String secretKey;
static HashMap<String, String> endPoints;
public Config() throws IOException
public Config(String compute_endpoint, String access_key, String secret_key) throws IOException
{
secure = false;
debug = false;

//Get Access Key and Secret Key from file
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("config.properties");
Properties prop = new Properties();

if(inputStream != null)
{
prop.load(inputStream);
}else
{
throw new FileNotFoundException("Property File Not Found");
}

accessKey = prop.getProperty("accessKey");
secretKey = prop.getProperty("secretKey");
secure = Boolean.parseBoolean(prop.getProperty("secure"));
debug = Boolean.parseBoolean(prop.getProperty("debug"));

secure = true;
debug = false;
accessKey = access_key;
secretKey = secret_key;
//Set up endpoints
endPoints = new HashMap<String, String>();
endPoints.put("compute","https://compute.ind-west-1.staging.jiocloudservices.com");
endPoints.put("vpc", "https://vpc.ind-west-1.jiocloudservices.com");
endPoints.put("dss", "https://dss.ind-west-1.jiocloudservices.com");
endPoints.put("iam", "https://iam.ind-west-1.jiocloudservices.com");
endPoints.put("rds", "https://rds.ind-west-1.jiocloudservices.com");
endPoints.put("compute", compute_endpoint);
}

public void setSecure(boolean sec)
{
secure=sec;
}
public void setDebug(boolean deb)
{
debug = deb;
}

public static boolean isSecure() {
return secure;
}
Expand Down