This is an "unofficial" client library for Central Dogma.
Central Dogma is an open-source, highly-available and version-controlled service configuration repository
Please visit the official web site for more information.
In Central Dogma, there are various use cases.
e.g.
- Service discovery
- Managing Rate limit configuration
- Managing A/B testing configuration
- etc
If you refer to a Central Dogma server via client library, an app can get a change immediately.
It means that no need to restart your app for applying that changes.
Configure something that you want to apply changes without restarting your server application.
$ npm i @matsumana/centraldogma-nodejs
You can get changes via EventEmitter continuously.
Please refer to the examples for more details.
import { CentralDogma } from '@matsumana/centraldogma-nodejs';
const centralDogma = new CentralDogma({
baseURL: 'http://localhost:36462',
});
const emitter = centralDogma.watch.watchFile({
project: 'project1',
repo: 'repo1',
filePath: '/example_config.json',
});
import { CentralDogma } from '@matsumana/centraldogma-nodejs';
const centralDogma = new CentralDogma({
baseURL: 'http://localhost:36462',
});
const entry = await centralDogma.content.getFile({
project: 'project1',
repo: 'repo1',
query: {
path: '/example_config.json',
type: QueryTypes.Identity,
},
});
import { CentralDogma } from '@matsumana/centraldogma-nodejs';
const centralDogma = new CentralDogma({
baseURL: 'http://localhost:36462',
});
const result = await centralDogma.content.push({
project: 'project1',
repo: 'repo1',
baseRevision: 'HEAD',
commitMessage: {
summary: 'Add /config1.json and /config2.json',
detail: 'You can write a detail for changes',
},
changes: [
{
path: '/config1.json',
type: ChangeTypes.UpsertJson,
content: { field1: 'foo' },
},
{
path: '/config2.json',
type: ChangeTypes.UpsertJson,
content: { field1: 'bar' },
},
],
});
There are some more APIs.