@@ -52,7 +52,6 @@ bool ignore_default_via_env(const std::string& param) {
52
52
// We should not use the default value for `vfs.s3.region` if the user
53
53
// has set either AWS_REGION or AWS_DEFAULT_REGION in their environment.
54
54
// We defer to the SDK to interpret these values.
55
-
56
55
if ((std::getenv (" AWS_REGION" ) != nullptr ) ||
57
56
(std::getenv (" AWS_DEFAULT_REGION" ) != nullptr )) {
58
57
return true ;
@@ -555,6 +554,7 @@ const std::set<std::string> Config::unserialized_params_ = {
555
554
Config::Config () {
556
555
// Set config values
557
556
param_values_ = default_config_values;
557
+ login ();
558
558
}
559
559
560
560
Config::~Config () = default ;
@@ -573,33 +573,32 @@ void Config::login() {
573
573
home_dir = std::string (std::getenv (" HOME" ));
574
574
#endif
575
575
576
- // For library versions 22 and older, simply parse the local .json file
577
- if (constants::format_version <= 22 ) {
576
+ // For library versions 2.27.0 and older, simply parse the local .json file
577
+ auto version = constants::library_version;
578
+ if (version[0 ] <= 2 && version[1 ] <= 27 ) {
578
579
// Find and parse the cloud.json file
579
580
std::string file = home_dir + " /.tiledb/cloud.json" ;
580
581
if (!std::filesystem::exists (file)) {
581
- throw ConfigException ( " Cannot login; cloud.json file does not exist. " ) ;
582
+ return ;
582
583
}
583
584
json data = json::parse (std::ifstream (file));
584
585
585
586
// Set the config values that have been saved to the file
586
587
if (data.contains (" api_key" ) &&
587
588
data[" api_key" ].contains (" X-TILEDB-REST-API-KEY" )) {
588
- throw_if_not_ok (
589
- set (" rest.token" , data[" api_key" ][" X-TILEDB-REST-API-KEY" ]));
589
+ set_internal (" rest.token" , data[" api_key" ][" X-TILEDB-REST-API-KEY" ]);
590
590
}
591
591
if (data.contains (" host" )) {
592
- throw_if_not_ok ( set ( " rest.server_address" , data[" host" ]) );
592
+ set_internal ( " rest.server_address" , data[" host" ]);
593
593
}
594
594
if (data.contains (" password" )) {
595
- throw_if_not_ok ( set ( " rest.password" , data[" password" ]) );
595
+ set_internal ( " rest.password" , data[" password" ]);
596
596
}
597
597
if (data.contains (" username" )) {
598
- throw_if_not_ok ( set ( " rest.username" , data[" username" ]) );
598
+ set_internal ( " rest.username" , data[" username" ]);
599
599
}
600
600
if (data.contains (" verify_ssl" )) {
601
- throw_if_not_ok (
602
- set (" vfs.s3.verify_ssl" , data[" verify_ssl" ] ? " true" : " false" ));
601
+ set_internal (" vfs.s3.verify_ssl" , data[" verify_ssl" ] ? " true" : " false" );
603
602
}
604
603
}
605
604
}
@@ -1030,6 +1029,11 @@ optional<std::string> Config::get_internal_string(
1030
1029
return {nullopt};
1031
1030
}
1032
1031
1032
+ void Config::set_internal (const std::string& param, const std::string& value) {
1033
+ throw_if_not_ok (sanity_check (param, value));
1034
+ param_values_[param] = value;
1035
+ }
1036
+
1033
1037
/*
1034
1038
* Explicit instantiations
1035
1039
*/
0 commit comments