assertNoLocalhost()
SIP Protocol API Reference v0.7.4
SIP Protocol API Reference / assertNoLocalhost
Function: assertNoLocalhost()
Section titled “Function: 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.
Parameters
Section titled “Parameters”string
URL to validate
string
Name of the config key (for error messages)
Returns
Section titled “Returns”string
The URL if valid
Throws
Section titled “Throws”ProductionSafetyError if localhost in production
Example
Section titled “Example”// Throws in production if localhostconst endpoint = assertNoLocalhost( process.env.RPC_ENDPOINT || 'http://localhost:8899', 'RPC_ENDPOINT')