async function getPublicIpAddress()

in src/resources/sql.ts [55:63]


async function getPublicIpAddress(): Promise<[string, string]> {
    const response = await fetch('https://api.ipify.org/');
    const ip = await response.text();
    // Use a range because the host ID part of the address can change mid-run in hosted agents
    const hostIdRegex = /\.[0-9]+$/;
    const start = ip.replace(hostIdRegex, '.0');
    const end = ip.replace(hostIdRegex, '.255');
    return [start, end];
}