@idoconfig/provider-folder
v1.3.6
Published
Provider for idoconfig that reads values from files within a folder Useful for Docker Secrets.
Downloads
8
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 "idoconfig";
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);