Skip to content

createProductionConfig()

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / createProductionConfig

createProductionConfig<T>(defaults): <K>(key, envValue?) => string

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

Create a production-safe configuration helper

Returns a function that validates URLs and provides defaults.

T extends Record<string, string>

T

Default values for non-production environments

Configuration getter function

<K>(key, envValue?): string

K extends string | number | symbol

K

string

string

const getConfig = createProductionConfig({
rpcEndpoint: 'http://localhost:8899',
apiUrl: 'http://localhost:3000',
})
// In dev: returns localhost
// In prod: throws if env vars not set
const rpc = getConfig('rpcEndpoint', process.env.RPC_ENDPOINT)