| 135 | } |
| 136 | |
| 137 | void Configuration::LoadDsn(const std::string& dsn) { |
| 138 | // Read keys before reading DSN to minimized unexpected behavior from ODBC driver |
| 139 | // managers. |
| 140 | auto customKeys = ReadAllKeys(dsn); |
| 141 | |
| 142 | Set(FlightSqlConnection::DSN, dsn); |
| 143 | Set(FlightSqlConnection::HOST, ReadDsnString(dsn, FlightSqlConnection::HOST)); |
| 144 | Set(FlightSqlConnection::PORT, ReadDsnString(dsn, FlightSqlConnection::PORT)); |
| 145 | Set(FlightSqlConnection::TOKEN, ReadDsnString(dsn, FlightSqlConnection::TOKEN)); |
| 146 | Set(FlightSqlConnection::UID, ReadDsnString(dsn, FlightSqlConnection::UID)); |
| 147 | Set(FlightSqlConnection::PWD, ReadDsnString(dsn, FlightSqlConnection::PWD)); |
| 148 | Set(FlightSqlConnection::TRUSTED_CERTS, |
| 149 | ReadDsnString(dsn, FlightSqlConnection::TRUSTED_CERTS)); |
| 150 | |
| 151 | #ifdef __APPLE__ |
| 152 | // macOS iODBC treats non-empty defaults as the real values when reading from system |
| 153 | // DSN, so we don't pass defaults on macOS. |
| 154 | // GH-49387 TODO: enable default values on macOS |
| 155 | Set(FlightSqlConnection::USE_ENCRYPTION, |
| 156 | ReadDsnString(dsn, FlightSqlConnection::USE_ENCRYPTION)); |
| 157 | Set(FlightSqlConnection::USE_SYSTEM_TRUST_STORE, |
| 158 | ReadDsnString(dsn, FlightSqlConnection::USE_SYSTEM_TRUST_STORE)); |
| 159 | Set(FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION, |
| 160 | ReadDsnString(dsn, FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION)); |
| 161 | #else |
| 162 | // Windows and Linux |
| 163 | Set(FlightSqlConnection::USE_ENCRYPTION, |
| 164 | ReadDsnString(dsn, FlightSqlConnection::USE_ENCRYPTION, DEFAULT_ENABLE_ENCRYPTION)); |
| 165 | Set(FlightSqlConnection::USE_SYSTEM_TRUST_STORE, |
| 166 | ReadDsnString(dsn, FlightSqlConnection::USE_SYSTEM_TRUST_STORE, |
| 167 | DEFAULT_USE_CERT_STORE)); |
| 168 | Set(FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION, |
| 169 | ReadDsnString(dsn, FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION, |
| 170 | DEFAULT_DISABLE_CERT_VERIFICATION)); |
| 171 | #endif // __APPLE__ |
| 172 | |
| 173 | RemoveAllKnownKeys(customKeys); |
| 174 | for (auto key : customKeys) { |
| 175 | std::string_view key_sv(key); |
| 176 | Set(key, ReadDsnString(dsn, key_sv)); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | void Configuration::Clear() { this->properties_.clear(); } |
| 181 |
no test coverage detected