# nestjs-config-aws-ksm

> Library of NESTJS, use config module with AWS Secret Manager.

Latest version **1.0.5** (published 2021-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install nestjs-config-aws-ksm
pnpm add nestjs-config-aws-ksm
yarn add nestjs-config-aws-ksm
bun add nestjs-config-aws-ksm
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2021-07-28 |
| First published | 2021-07-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 23.1 KB |
| Known vulnerabilities | 0 (+4 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Blackstone Studio |
| Maintainers | nishikawa7863, kauyumari, aleexsolis |

## Links

- npm: https://www.npmjs.com/package/nestjs-config-aws-ksm
- Repository: https://github.com/BlackstoneStudio/nestjs-config-aws-ksm
- Homepage: https://github.com/BlackstoneStudio/nestjs-config-aws-ksm#readme
- Issues: https://github.com/BlackstoneStudio/nestjs-config-aws-ksm/issues
- npm.io page: https://npm.io/package/nestjs-config-aws-ksm

## Dependencies (7)

- [jest](https://npm.io/package/jest.md) ^27.0.6
- [rxjs](https://npm.io/package/rxjs.md) ^7.2.0
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.949.0
- [@nestjs/core](https://npm.io/package/@nestjs/core.md) ^8.0.4
- [@nestjs/common](https://npm.io/package/@nestjs/common.md) ^8.0.4
- [@nestjs/testing](https://npm.io/package/@nestjs/testing.md) ^8.0.4
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13

## Recent versions

- 1.0.5 (latest) — 2021-07-28
- 1.0.4 — 2021-07-28
- 1.0.3 — 2021-07-28
- 1.0.1 — 2021-07-28
- 1.0.0 — 2021-07-20

## README

<a href="https://www.blackstone.studio/" target="_blank"><img src="https://blackstone-open-assets.s3-us-west-2.amazonaws.com/header.png" alt="Blackstone Studio - In Development We Trust"></a>

# NestJS ConfigModule With AWS Secret Manager

<p>
  <img alt="Version" src="https://img.shields.io/badge/version-1.0.5-blue.svg?cacheSeconds=2592000" />
  <a href="https://github.com/BlackstoneStudio/Parrot-Messenger/" target="_blank">
    <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
  </a>
  <a href="https://github.com/BlackstoneStudio/Parrot-Messenger/graphs/commit-activity" target="_blank">
    <img alt="Maintenance" src="https://img.shields.io/badge/Maintained-yes-green.svg" />
  </a>
  <a href="https://nestjs.com" target="_blank">
    <img src="https://img.shields.io/badge/Module%20of-NestJs-red.svg" alt="Built with NestJS">
  </a>
</p>

## Table of Contents

- [Installation](#installation)
- [Initialization](#initialization)
- [Notes](#notes)

## Installation

Using npm:

```bash
npm install nestjs-config-aws-ksm
```

Using yarn:

```bash
yarn add nestjs-config-aws-ksm
```

## Initialization

1. Import `ConfigModule` in your module.

```ts
import { Module } from '@nestjs/common';
import { ConfigModule } from 'nestjs-config-aws-ksm';
import { NameService } from './name.service';

@Module({
  imports: [
    ConfigModule.register({
      accessKey: 'AWS_ACCESS_KEY',
      secretAccessKey: 'AWS_ACCESS_SECRET_KEY',
      region: 'AWS_REGION',
      storage: 'STORAGE_NAME'
    }),
  ],
  providers: :[NameService],
  exports: [NameService],
})

export class NameModule {}
```

2. Import and use `ConfigService` in your Service.

```ts
import { Injectable } from '@nestjs/common';
import { ConfigService } from 'nestjs-config-aws-ksm';

@Injectable()
export class NameService {
  constructor(configService: ConfigService) {
    configService.get('SECRET_AWS_OR_ENV_VARIABLE');
  }
}
```

## Notes

Given that the register method is asynchronous the variables may not be loaded yet. If you need to load it via `registerAsync` we recommend using the `loadStorage` method. Example:

```ts
import { Module } from '@nestjs/common';
import { ConfigModule } from 'nestjs-config-aws-ksm';
import { NameService } from './name.service';

@Module({
  imports: [
    JwtModule.registerAsync({
      imports: [ConfigModule.register({
        accessKey: 'AWS_ACCESS_KEY',
        secretAccessKey: 'AWS_ACCESS_SECRET_KEY',
        region: 'AWS_REGION',
        storage: 'STORAGE_NAME'
      })],
      useFactory: async (configService: ConfigService) => {
        await configService.loadStorage('STORAGE_NAME');
        return ({
          secret: configService.get('JWT_SECRET'),
          signOptions: { expiresIn: "72h" },
        })
      },
      inject: [ConfigService],
    }),
  ],
  providers: :[NameService],
  exports: [NameService],
})

export class NameModule {}
```

## Who are we

We are the development partner of choice for several different sized companies who need a team that delivers fast & scalable code understanding users needs and commercial scope.

### Our services

- Website development
- UX/UI Design
- Webapp Development
- Mobile Development
- Ecommerce
- Specialized enterprise software
- Legacy migrations, debugging and refactors

### Why us?

We don't outsource a single thing. Each wireframe, design and every piece of code is written with outmost care by Blackstone's diverse teams.

## 🛠 Built With

- [Node.js](https://nodejs.org/en/) - Backend

## 🤝 Contributing

Contributions, issues and feature requests are welcome!

You can also suggest a new feature by creating an Issue. Please wait for confirmation before working on it.

## 📝 License

Copyright © 2020 [Blackstone Studio](https://github.com/Blasckstone-Studio).

This project is [MIT](https://github.com/BlackstoneStudio/Parrot-Messenger/master/LICENSE) licensed.

<a href="https://www.blackstone.studio/we-are-blackstone/" target="_blank"><img src="https://blackstone-open-assets.s3-us-west-2.amazonaws.com/footer.png" alt="We are blackstone - Contact us"></a>

---
_Source: https://npm.io/package/nestjs-config-aws-ksm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
