1 | |
2 | |
3 | * Create an environment variable override at the project level |
4 | * - Allows you to override at project level an environment variable that has a higher scope. |
5 | - You only have to specify a value in the request body |
6 | - The system will create a new environment variable at project level with the same key as the one corresponding to the variable id in the path |
7 | - The response body will contain the newly created variable |
8 | - Information regarding the overridden_variable will be exposed in the "overridden_variable" field of the newly created variable |
9 |
|
10 | */ |
11 | export async function main( |
12 | auth: RT.Qovery, |
13 | projectId: string, |
14 | environmentVariableId: string, |
15 | body: EnvironmentVariableOverrideRequest |
16 | ) { |
17 | const url = new URL( |
18 | `https://api.qovery.com/project/${projectId}/environmentVariable/${environmentVariableId}/override` |
19 | ) |
20 |
|
21 | const response = await fetch(url, { |
22 | method: 'POST', |
23 | headers: { |
24 | 'Content-Type': 'application/json', |
25 | Authorization: 'Token ' + auth.apiKey |
26 | }, |
27 | body: JSON.stringify(body) |
28 | }) |
29 | if (!response.ok) { |
30 | const text = await response.text() |
31 | throw new Error(`${response.status} ${text}`) |
32 | } |
33 | return await response.json() |
34 | } |
35 |
|
36 | |
37 | |
38 | * This file was automatically generated by json-schema-to-typescript. |
39 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
40 | * and run json-schema-to-typescript to regenerate this file. |
41 | */ |
42 |
|
43 | export interface EnvironmentVariableOverrideRequest { |
44 | value?: 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 |
|