@@ -22,7 +22,7 @@ public class TileDBClient{
22
22
private static String password ;
23
23
private static String basePath ;
24
24
25
- private static boolean verifyingSsl = true ;
25
+ private static boolean verifyingSsl ;
26
26
27
27
private static boolean loginInfoIsInJSONFile ;
28
28
@@ -42,8 +42,9 @@ public class TileDBClient{
42
42
apiKey = "" ;
43
43
username = "" ;
44
44
password = "" ;
45
- basePath = "https://api.tiledb.com/v1" ;
45
+ basePath = "https://api.tiledb.com/v1" ; //default is TileDB
46
46
loginInfoIsInJSONFile = true ;
47
+ verifyingSsl = true ;
47
48
48
49
// set path according to OS
49
50
if (System .getProperty ("os.name" ).toLowerCase ().contains ("windows" )){
@@ -99,6 +100,16 @@ private static boolean loadCloudJSONFileFromHome() throws IOException {
99
100
logger .log (Level .INFO , "Found verifySSL from disk" );
100
101
}
101
102
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
+
102
113
// check if credentials are adequate for logging in
103
114
if ((Objects .equals (apiKey , "" ) && (Objects .equals (password , "" ) && !Objects .equals (username , "" ))
104
115
|| (Objects .equals (apiKey , "" ) && ((Objects .equals (password , "" ) || Objects .equals (username , "" )))))){
@@ -132,6 +143,11 @@ private void findCredentials(TileDBLogin tileDBLogin) {
132
143
* @param tileDBLogin The Login object
133
144
*/
134
145
private void populateFieldsFromLogin (TileDBLogin tileDBLogin ) {
146
+ if (!tileDBLogin .getHost ().equals ("" )){
147
+ basePath = tileDBLogin .getHost ();
148
+ } else {
149
+ basePath = "https://api.tiledb.com/v1" ;
150
+ }
135
151
apiKey = tileDBLogin .getApiKey ();
136
152
username = tileDBLogin .getUsername ();
137
153
password = tileDBLogin .getPassword ();
@@ -155,7 +171,11 @@ private void writeAuthJSONFileToHome() {
155
171
jsonObject .put ("api_key" , apiKeyObject );
156
172
jsonObject .put ("username" , username );
157
173
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
+ }
159
179
jsonObject .put ("verify_ssl" , verifyingSsl );
160
180
try {
161
181
File file = new File (homeDir + cloudFilePath );
0 commit comments