0

Edit a variable

by
Published Oct 17, 2025

- You can't edit a BUILT_IN variable - For an override, you can't edit the key - For an alias, you can't edit the value

Script qovery Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Edit a variable
4
 * - You can't edit a BUILT_IN variable
5
- For an override, you can't edit the key
6
- For an alias, you can't edit the value
7

8
 */
9
export async function main(auth: RT.Qovery, variableId: string, body: Body) {
10
	const url = new URL(`https://api.qovery.com/variable/${variableId}`)
11

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

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

34
export interface Body {
35
	/**
36
	 * the key of the environment variable
37
	 */
38
	key: string
39
	/**
40
	 * the value of the environment variable
41
	 */
42
	value?: string
43
	/**
44
	 * optional variable description (255 characters maximum)
45
	 */
46
	description?: string
47
	enable_interpolation_in_file?: boolean
48
	[k: string]: unknown
49
}
50