97b2089857
- Added `--route` and `--method` options to `function execute` command for better HTTP handling. - Improved `get function` command to display additional function metadata including HTTP settings, cache status, network restrictions, RAM limits, timeouts, and tags. - Removed deprecated `helloworld` command. - Expanded `update function` command with new options for Docker mounts, network restrictions, and various installation flags, including better error handling for boolean and number options. - Introduced environment variable management commands: `add`, `list`, and `remove` for account-wide environment variables. - Added `export` command to export authenticated account data. - Implemented `api openapi` and `api request` commands for direct API interaction. - Created logging and rate limit management commands for functions. - Added MCP tool commands for calling tools, fetching documentation, and initializing sessions. - Introduced utility functions for JSON handling and environment variable normalization. - Set up CI/CD pipeline with Gitea Actions for automated testing, building, and publishing. - Updated configuration loading to support environment variables for instance and token.
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import chalk from "chalk";
|
|
import { getApiClient } from "../../../api.js";
|
|
import { normalizeEnvList } from "../../../utils/env_vars.js";
|
|
|
|
export const accountEnvRemoveDefinition = {
|
|
name: "remove",
|
|
description: "Remove an account-wide environment variable.",
|
|
options: [
|
|
{ name: "--name <name>", description: "Environment variable name", required: true },
|
|
],
|
|
action: async (options: any) => {
|
|
const client = await getApiClient();
|
|
|
|
try {
|
|
const current = await client.get("/api/account/settings");
|
|
const env = normalizeEnvList(current.data?.data?.accountEnvironment);
|
|
const next = env.filter((item) => item.name !== options.name);
|
|
|
|
if (next.length === env.length) {
|
|
console.log(`${chalk.yellow("!")} Account environment variable ${chalk.cyan(options.name)} was not found.`);
|
|
return;
|
|
}
|
|
|
|
await client.patch("/api/account/settings", {
|
|
accountEnvironment: next,
|
|
});
|
|
|
|
console.log(`${chalk.green("✓")} Account environment variable ${chalk.cyan(options.name)} removed.`);
|
|
} catch (error: any) {
|
|
console.error(`${chalk.red("✗")} ${error.response?.data?.message || error.message}`);
|
|
}
|
|
},
|
|
};
|