npm i -g ilink-console-tools
https://github.com/i-link-pro-team/ilink/blob/master/libs/ilink-console-tools/README.md - full readme
# upload from file to consul-kv
ilink-console-tools env-to-consul --path=.env --consul-token=myCustomToken --consul-host=localhost
# download from consul-kv to file
ilink-console-tools consul-to-env --consul-token=myCustomToken --path=.env --consul-host=localhost
npm i --save consul nestjs-consul-kv-realtime
https://github.com/i-link-pro-team/ilink/blob/master/libs/nestjs-consul-kv-realtime/README.md - full readme
import { Module } from '@nestjs/common';
import { NestjsConsulKvRealtimeModule } from 'nestjs-consul-kv-realtime';
@Module({
imports: [
NestjsConsulKvRealtimeModule.forRootAsync({
useFactory: async () => ({
port: '8500',
host: 'localhost',
defaults: {
token: `CONSUL_HTTP_TOKEN`,
},
watchers: [
{
interval: 1000,
key: 'consul-key',
callback: async (value: { key: string }) => {
console.log('New value from consul:', value);
},
},
],
}),
}),
],
})
export class AppModule {}
MIT