Hono environment type that extends Env
Configuration options for Secrets Manager client
Hono middleware that sets Secrets Manager instances
import { Hono } from 'hono';
import { secretsManagerMiddleware, Env } from '@squilla/hono-aws-middlewares';
const app = new Hono<Env>();
// Set up middleware
app.use('*', secretsManagerMiddleware({
region: 'ap-northeast-1'
}));
// Use Secrets Manager
app.get('/config', async (c) => {
const secretsManager = c.get('SecretsManager');
const result = await secretsManager.getSecretValue({
SecretId: 'prod/myapp/config'
});
return c.json({ config: result.SecretString });
});
Secrets Manager middleware for Hono
Creates AWS SDK v3 SecretsManager and SecretsManagerClient instances and sets them in the Hono context to generate middleware.