Environment Variable
This chapter describes the methods for listing, writing, and deleting environment variables on
makers.projects.Environment variables apply to the entire project and are not split between production and preview environments.
deployments.deploy does not accept environment variables. You can write them together through initialEnvVars/initial_env_vars when creating a project.Data Model
projects.listEnvs / projects.list_envs returns an environment variable object. projects.setEnvs / projects.set_envs and projects.deleteEnvs / projects.delete_envs have no return value.Field | Type | Required | Description |
key | string/str | Yes | Variable Name |
value | string/str | Yes | Variable value. |
comment | string/str | No | Remarks |
projects.listEnvs / projects.list_envs
List all environment variables of the project.
Parameter
Parameter | Type | Required | Description |
projectId/project_id | string/str | Yes | Project ID |
Return Value
Promise<EnvVar[]>/list[dict]
Examples
const envVars = await makers.projects.listEnvs({projectId: "your-project-id",});for (const envVar of envVars) {console.log(envVar.key, envVar.comment);}
env_vars = makers.projects.list_envs(project_id="your-project-id")for env_var in env_vars:print(env_var["key"], env_var.get("comment"))
projects.setEnvs / projects.set_envs
Existing variable names will be overwritten, while variable names that are not passed in retain their original values. If duplicate variable names appear in the same batch of parameters, a
ValidationError is thrown before the request is sent.Parameter
Parameter | Type | Required | Description |
projectId/project_id | string/str | Yes | Project ID |
envVars/env_vars | EnvVar[]/list[dict] | Yes | Variables to write, overwritten or added by variable name |
Return Value
Promise<void>/None
Examples
await makers.projects.setEnvs({projectId: "your-project-id",envVars: [{ key: "API_URL", value: "https://example.com", comment: "origin" },],});
makers.projects.set_envs(project_id="your-project-id",env_vars=[{"key": "API_URL","value": "https://example.com","comment": "origin",},],)
projects.deleteEnvs / projects.delete_envs
If duplicate items appear in
keys, a ValidationError is thrown before the request is sent.Parameter
Parameter | Type | Required | Description |
projectId/project_id | string/str | Yes | Project ID |
keys | string[]/list[str] | Yes | Variable names to delete |
Return Value
Promise<void>/None
Examples
await makers.projects.deleteEnvs({projectId: "your-project-id",keys: ["API_URL"],});
makers.projects.delete_envs(project_id="your-project-id",keys=["API_URL"],)
