@capsulajs/capsulajs-configuration-service
v0.1.17
Published
Capsula-JS Configuration Service
Downloads
37
Keywords
Readme
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:
- "localFile"
- "httpFile"
- "scalecube"
- "httpServer"
- "localStorage"
Example
try {
const HttpFileConfigurationProvider = getProvider({ configProvider: "localFile" as LocalFileConfigurationProvider });
const configurationService = new HttpFileConfigurationProvider("http://localhost:1234");
} catch(error) {
console.log('error.message');
}