0

Add an environment variable to the application

by
Published Oct 17, 2025

- Add an environment variable to the application.

Script qovery Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Add an environment variable to the application
4
 * - Add an environment variable to the application.
5

6
 */
7
export async function main(auth: RT.Qovery, applicationId: string, body: Body) {
8
	const url = new URL(`https://api.qovery.com/application/${applicationId}/environmentVariable`)
9

10
	const response = await fetch(url, {
11
		method: 'POST',
12
		headers: {
13
			'Content-Type': 'application/json',
14
			Authorization: 'Token ' + auth.apiKey
15
		},
16
		body: JSON.stringify(body)
17
	})
18
	if (!response.ok) {
19
		const text = await response.text()
20
		throw new Error(`${response.status} ${text}`)
21
	}
22
	return await response.json()
23
}
24

25
/* eslint-disable */
26
/**
27
 * This file was automatically generated by json-schema-to-typescript.
28
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
29
 * and run json-schema-to-typescript to regenerate this file.
30
 */
31

32
export interface Body {
33
	/**
34
	 * key is case sensitive.
35
	 */
36
	key: string
37
	/**
38
	 * value of the env variable.
39
	 */
40
	value?: string
41
	/**
42
	 * should be set for file only. variable mount path makes variable a file (where file should be mounted).
43
	 */
44
	mount_path?: string
45
	/**
46
	 * optional variable description (255 characters maximum)
47
	 */
48
	description?: string
49
	enable_interpolation_in_file?: boolean
50
	[k: string]: unknown
51
}
52