0

Create a secret override at the container level

by
Published Oct 17, 2025

- Allows you to override at container level a secret that has a higher scope. - You only have to specify a value in the request body - The system will create a new secret at container level with the same key as the one corresponding to the secret id in the path - The response body will contain the newly created secret - Information regarding the overridden_secret will be exposed in the "overridden_secret" field of the newly created secret

Script qovery Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Create a secret override at the container level
4
 * - Allows you to override at container level a secret that has a higher scope.
5
- You only have to specify a value in the request body
6
- The system will create a new secret at container level with the same key as the one corresponding to the secret id in the path
7
- The response body will contain the newly created secret
8
- Information regarding the overridden_secret will be exposed in the "overridden_secret" field of the newly created secret
9

10
 */
11
export async function main(
12
	auth: RT.Qovery,
13
	containerId: string,
14
	secretId: string,
15
	body: EnvironmentVariableOverrideRequest
16
) {
17
	const url = new URL(`https://api.qovery.com/container/${containerId}/secret/${secretId}/override`)
18

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

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

41
export interface EnvironmentVariableOverrideRequest {
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