idoconfig-provider-folder
v1.1.4
Published
Provider for i-do-config that reads values from files within a folder Useful for Docker Secrets.
Downloads
12
Maintainers
Readme
Folder Provider
Read values from files within a folder and make them accessible through Configuration
Installation & Setup
Add this package to your package.json
npm install --save idoconfig-provider-folder
Use it!
import { FolderConfigurationValueProvider } from "idoconfig-provider-folder";
// Use it
const folderProvider = new FolderConfigurationValueProvider();
const configuration = new Configuration([folderProvider]);
const value = configuration.getValue("my-key");
Use with dependency injection
I'm using inversify.io
import Container from "inversify";
import { Configuration, IConfiguration, IConfigurationValueProvider } from "i-do-config";
import { FolderConfigurationValueProvider } from "idoconfig-provider-folder";
const di = new Container({ defaultScope: "Singleton" });
decorate(injectable(), Configuration);
decorate(injectable(), FolderConfigurationValueProvider);
di.bind<IConfigurationValueProvider>("ConfigProvider").to(FolderConfigurationValueProvider);
di.bind<IConfiguration>("Configuration").to(Configuration);