fix: regex for multi-region IPs (#16410)

* regex for multi-region IPs

* Update index.tsx
This commit is contained in:
AAfghahi
2021-08-23 16:54:25 -04:00
committed by GitHub
parent c768941f2f
commit a6aad52e38

View File

@@ -853,8 +853,9 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
const { hostname } = window.location;
let ipAlert = connectionAlert?.REGIONAL_IPS?.default || '';
const regionalIPs = connectionAlert?.REGIONAL_IPS || {};
Object.entries(regionalIPs).forEach(([regex, ipRange]) => {
if (regex.match(hostname)) {
Object.entries(regionalIPs).forEach(([ipRegion, ipRange]) => {
const regex = new RegExp(ipRegion);
if (hostname.match(regex)) {
ipAlert = ipRange;
}
});