0

Create an environment variable alias at the application level

by
Published Oct 17, 2025

- Allows you to add an alias at application level on an existing environment variable having higher scope, in order to customize its key.

Script qovery Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Create an environment variable alias at the application level
4
 * - Allows you to add an alias at application level on an existing environment variable having higher scope, in order to customize its key.
5
 */
6
export async function main(
7
	auth: RT.Qovery,
8
	applicationId: string,
9
	environmentVariableId: string,
10
	body: EnvironmentVariableAliasRequest
11
) {
12
	const url = new URL(
13
		`https://api.qovery.com/application/${applicationId}/environmentVariable/${environmentVariableId}/alias`
14
	)
15

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

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

38
export interface EnvironmentVariableAliasRequest {
39
	key: string
40
	/**
41
	 * optional variable description (255 characters maximum)
42
	 */
43
	description?: string
44
	enable_interpolation_in_file?: boolean
45
	[k: string]: unknown
46
}
47