| 139 | char* session_credentials::root_path_guc_string = nullptr; |
| 140 | |
| 141 | icm::string_map<> session_credentials::get_credentials() |
| 142 | { |
| 143 | icm::string_map<> creds_map; |
| 144 | |
| 145 | if (creds_guc_string != nullptr && std::strlen(creds_guc_string) > 0) { |
| 146 | try { |
| 147 | auto creds_json = icm::json::parse(creds_guc_string); |
| 148 | for (auto it = creds_json.begin(); it != creds_json.end(); ++it) { |
| 149 | std::string key_str(it.key()); |
| 150 | if (it.value().is_string()) { |
| 151 | creds_map[key_str] = it.value().get<std::string>(); |
| 152 | } else { |
| 153 | elog(WARNING, "Credential value for key '%s' is not a string, skipping", key_str.c_str()); |
| 154 | } |
| 155 | } |
| 156 | } catch (const std::exception& e) { |
| 157 | elog(WARNING, "Failed to parse deeplake.creds: %s. Using environment variables.", e.what()); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | return creds_map; |
| 162 | } |
| 163 | |
| 164 | std::string session_credentials::get_root_path() |
| 165 | { |