Skip to content

crelte / / getEnv

Function: getEnv()

Call Signature

ts
function getEnv(name): string;

returns an env variable from the craft/.env file. All env variables need to start with VITE_ except ENDPOINT_URL, CRAFT_WEB_URL and FRONTEND_URL

Note

This only works during component initialisation.

Parameters

name

"ENDPOINT_URL"

Returns

string

Call Signature

ts
function getEnv(name): string;

returns an env variable from the craft/.env file. All env variables need to start with VITE_ except ENDPOINT_URL, CRAFT_WEB_URL and FRONTEND_URL

Note

This only works during component initialisation.

Parameters

name

"CRAFT_WEB_URL"

Returns

string

Call Signature

ts
function getEnv(name): string;

returns an env variable from the craft/.env file. All env variables need to start with VITE_ except ENDPOINT_URL, CRAFT_WEB_URL and FRONTEND_URL

Note

This only works during component initialisation.

Parameters

name

"FRONTEND_URL"

Returns

string

Call Signature

ts
function getEnv(name): string | null;

returns an env variable from the craft/.env file. All env variables need to start with VITE_ except ENDPOINT_URL, CRAFT_WEB_URL and FRONTEND_URL

Note

This only works during component initialisation.

Parameters

name

string

Returns

string | null