Skip to content

assertNoLocalhost()

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / assertNoLocalhost

assertNoLocalhost(url, name): string

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:22859

Assert that a URL is not localhost in production

Convenience function for validating individual URLs.

string

URL to validate

string

Name of the config key (for error messages)

string

The URL if valid

ProductionSafetyError if localhost in production

// Throws in production if localhost
const endpoint = assertNoLocalhost(
process.env.RPC_ENDPOINT || 'http://localhost:8899',
'RPC_ENDPOINT'
)