0.1.17 • Published 2 years ago

@capsulajs/capsulajs-configuration-service v0.1.17

Weekly downloads
105
License
MIT
Repository
-
Last release
2 years ago

Configuration Service

Providers

localFile

Configuration will be included in a local json file.

Example token: "./path/to/configuration"

httpFile

Configuration will be included in a json file on some external http/https host and will be served statically.

Example token: "http://localhost:1234"

scalecube

Configuration will be available as an entry point of a special Scalecube server.

httpServer

Configuration will be available as an entry point of some http/https server.

Example token: "http://localhost:1234"

localStorage

Configuration will be available under a special key in localStorage.

Example token: "configurationKey"

GetProvider util

Is used to get the class of an appropriate ConfigurationProvider.

Will throw an error, if wrong configProvider is provided in the call of the function.

Possible values for configProvider: 1. "localFile" 2. "httpFile" 3. "scalecube" 4. "httpServer" 5. "localStorage"

Example

try {
  const HttpFileConfigurationProvider = getProvider({ configProvider: "localFile" as LocalFileConfigurationProvider });
  const configurationService = new HttpFileConfigurationProvider("http://localhost:1234");
} catch(error) {
  console.log('error.message');
}