@@ -22,7 +22,7 @@ public class TileDBClient{
2222 private static String password ;
2323 private static String basePath ;
2424
25- private static boolean verifyingSsl = true ;
25+ private static boolean verifyingSsl ;
2626
2727 private static boolean loginInfoIsInJSONFile ;
2828
@@ -42,8 +42,9 @@ public class TileDBClient{
4242 apiKey = "" ;
4343 username = "" ;
4444 password = "" ;
45- basePath = "https://api.tiledb.com/v1" ;
45+ basePath = "https://api.tiledb.com/v1" ; //default is TileDB
4646 loginInfoIsInJSONFile = true ;
47+ verifyingSsl = true ;
4748
4849 // set path according to OS
4950 if (System .getProperty ("os.name" ).toLowerCase ().contains ("windows" )){
@@ -99,6 +100,16 @@ private static boolean loadCloudJSONFileFromHome() throws IOException {
99100 logger .log (Level .INFO , "Found verifySSL from disk" );
100101 }
101102
103+ if (object .has ("host" )){
104+ String host = object .getString ("host" );
105+ if (host .equals ("https://api.tiledb.com" )){
106+ basePath = host + "/v1" ;
107+ } else {
108+ basePath = host ;
109+ }
110+ logger .log (Level .INFO , "Found host from disk" );
111+ }
112+
102113 // check if credentials are adequate for logging in
103114 if ((Objects .equals (apiKey , "" ) && (Objects .equals (password , "" ) && !Objects .equals (username , "" ))
104115 || (Objects .equals (apiKey , "" ) && ((Objects .equals (password , "" ) || Objects .equals (username , "" )))))){
@@ -132,6 +143,11 @@ private void findCredentials(TileDBLogin tileDBLogin) {
132143 * @param tileDBLogin The Login object
133144 */
134145 private void populateFieldsFromLogin (TileDBLogin tileDBLogin ) {
146+ if (!tileDBLogin .getHost ().equals ("" )){
147+ basePath = tileDBLogin .getHost ();
148+ } else {
149+ basePath = "https://api.tiledb.com/v1" ;
150+ }
135151 apiKey = tileDBLogin .getApiKey ();
136152 username = tileDBLogin .getUsername ();
137153 password = tileDBLogin .getPassword ();
@@ -155,7 +171,11 @@ private void writeAuthJSONFileToHome() {
155171 jsonObject .put ("api_key" , apiKeyObject );
156172 jsonObject .put ("username" , username );
157173 jsonObject .put ("password" , password );
158- jsonObject .put ("host" , "https://api.tiledb.com" );
174+ if (basePath .equals ("https://api.tiledb.com/v1" )){
175+ jsonObject .put ("host" , "https://api.tiledb.com" );
176+ }else {
177+ jsonObject .put ("host" , basePath );
178+ }
159179 jsonObject .put ("verify_ssl" , verifyingSsl );
160180 try {
161181 File file = new File (homeDir + cloudFilePath );
0 commit comments