25 lines
679 B
TypeScript
25 lines
679 B
TypeScript
import axios from "axios";
|
|
|
|
export class EnvVar
|
|
{
|
|
constructor (
|
|
public key: string,
|
|
public value: string
|
|
) {}
|
|
|
|
static get(namespace: string, name: string, containerName: string, onSuccess: (envVars: EnvVar[]) => void, onError: () => void)
|
|
{
|
|
const url = StringUtils.format('%s/pods/%s/%s/%s/env', ApiConfig.getHttpBase(), namespace, name, containerName);
|
|
axios.get<EnvVar[]>(url, {
|
|
headers: {
|
|
Authorization: "Bearer " + requireToken()
|
|
}
|
|
})
|
|
.then((response) => {
|
|
onSuccess(response.data);
|
|
})
|
|
.catch(() => {
|
|
onError();
|
|
});
|
|
}
|
|
} |