Skip to content

capsulajs/configuration-service

Repository files navigation

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');
}

About

capsulajs configuration service

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 11