Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use v1/content/{guid}/environment to modify environment variables #37

Open
aronatkins opened this issue Jun 26, 2024 · 0 comments · May be fixed by #40
Open

use v1/content/{guid}/environment to modify environment variables #37

aronatkins opened this issue Jun 26, 2024 · 0 comments · May be fixed by #40
Assignees

Comments

@aronatkins
Copy link
Contributor

Use GET /__api__/v1/content/{guid}/environment to obtain the names of configured environment variables.

public async getAppEnvironment (appID: number): Promise<AppEnvironmentResponse> {
return await this.client.get(`applications/${appID}/environment`)
.then((resp: AxiosResponse) => {
const camelized = keysToCamel(resp.data)
camelized.values = resp.data.values
return camelized
})
}

This returns a list of environment variable names.

Use PUT /__api__/v1/content/{guid}/environment to overwrite all environment variables or PATCH /__api__/v1/content/{guid}/environment to modify a subset of variables.

public async updateAppEnvironment (appID: number, version: number, env: Environment): Promise<AxiosResponse> {
return await this.client.post(
`applications/${appID}/environment`,
{ app_id: appID, version, values: Object.fromEntries(env.entries()) }
)
}

This accepts a list of objects indicating the variable name and its value.

Documentation references:

aronatkins added a commit that referenced this issue Jun 28, 2024
Does not delete environment variables from content; only adds or overwrites
environment variables based on local state.

fixes #37
@aronatkins aronatkins self-assigned this Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant