env
Environment variables.
Import
ts
import { Env } from "env";Needs the "env" permission in thicket.json.
Env static class
ts
static class EnvEnv.delete
ts
static delete(name: string): voidRemove an environment variable.
Parameters
name: The name of the variable to delete.
Env.entries
ts
static entries(): anyGet all environment variables as an array of [key, value] pairs.
Returns: An array of [name, value] tuples.
Env.get
ts
static get(name: string): anyGet an environment variable value.
Parameters
name: The name of the variable.
Returns: The variable's value, or null if not set.
Example
ts
import { Env } from "env";
const home: any = Env.get("HOME");
console.log(home != null); // trueEnv.has
ts
static has(name: string): booleanCheck whether an environment variable is set.
Parameters
name: The name of the variable.
Returns: true if the variable exists, false otherwise.
Example
ts
import { Env } from "env";
if (Env.has("HOME")) {
console.log("HOME is set");
}Env.keys
ts
static keys(): anyGet all environment variable names.
Returns: An array of variable names.
Env.set
ts
static set(name: string, value: string): voidSet an environment variable.
Parameters
name: The name of the variable.value: The value to set.
Generated from lang/types/env.d.tks in the ThicketScript repository.