API: env
Source:
core/env.ts
API Env
- Provides a static interface for accessing and listing environment variables exposed to the runtime.
Usage
javascript
import { env } from "sdk/core";
import { response } from "sdk/http";
let os = env.get("os.name");
response.println("[OS]: " + os);
response.flush();
response.close();Classes
Env
Interface representing a map of environment variable names to their string values.
Methods
get
get (name:string):string|undefinedRetrieves the value of the environment variable with the specified name.
@param name The name of the environment variable.
@returns The variable's value as a string, orundefinedif the variable is not set.
list
list ():EnvValuesRetrieves a map of all environment variables currently exposed to the application.
@returns An {@link EnvValues} object containing all environment variables as key-value pairs.