This guide explains the get-dotenv API Gateway plugin exported by this package:
apiGatewayPlugin() → mounts under aws and provides:
aws api-gateway flush-cacheaws api-gateway pull-keysIf you want the programmatic API instead, see the AwsApiGatewayTools guide.
npm i @karmaniverous/aws-api-gateway-tools
You can either:
aws-api-gateway-tools), orapiGatewayPlugin() inside your own get-dotenv host.The shipped CLI is a get-dotenv CLI host composed with aws + api-gateway:
aws-api-gateway-tools aws api-gateway flush-cache
aws-api-gateway-tools aws api-gateway pull-keys --key-names '$API_KEY_A' '$API_KEY_B'
Notes:
$VAR expansion evaluated at action time against { ...process.env, ...ctx.dotenv } (ctx.dotenv wins).Mount the plugin under aws:
import { createCli } from '@karmaniverous/get-dotenv/cli';
import { awsPlugin } from '@karmaniverous/get-dotenv/plugins';
import { apiGatewayPlugin } from '@karmaniverous/aws-api-gateway-tools';
await createCli({
alias: 'toolbox',
compose: (program) => program.use(awsPlugin().use(apiGatewayPlugin())),
})();
Region sourcing:
ctx.plugins.aws.region) when available.aws plugin may export them into process.env depending on its configuration).aws api-gateway flush-cacheFlushes a REST API stage cache.
Flags:
--api-id <string>: REST API id (conflicts with --api-name)
$API_ID--api-name <string>: REST API name (conflicts with --api-id)
$API_NAME--stage-name <string>: stage name
$STAGE_NAMEAll three support $VAR expansion at action time.
If api-id resolves, the plugin flushes directly; otherwise it resolves the REST API id by name and then flushes.
aws api-gateway pull-keysRetrieves one or more API key values and writes them into a dotenv variable as a delimiter-joined string.
Flags:
--key-names <string...> (required): space-delimited list of API key names--variable-name <string> (default API_KEYS): dotenv variable name to write--delimiter <string> (default ", "): delimiter used to join values--to <scope:privacy> (default env:private): destination dotenv selector--template-extension <string> (default template): bootstrap extensionKey behavior: