diff --git a/.gitignore b/.gitignore index b93d393..1eb58b3 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,10 @@ # Project specific ignores /var +aditya.creds +test.creds +config.json + migrateTimestamps.pl test_ccms_api.sh test_ccms_free_api.sh diff --git a/configs/config.json b/configs/config.json index 23d8a10..f38bc3d 100644 --- a/configs/config.json +++ b/configs/config.json @@ -166,12 +166,12 @@ } }, "checkpoints": { - "interval": "1h", + "interval": "12h", "directory": "./var/checkpoints", - "restore": "1h" + "restore": "48h" }, "archive": { - "interval": "2h", + "interval": "50h", "directory": "./var/archive" }, "http-api": { @@ -179,7 +179,18 @@ "https-cert-file": null, "https-key-file": null }, - "retention-in-memory": "1h", - "nats": null, + "retention-in-memory": "48h", + "nats": [ + { + "address": "nats://localhost:4222", + "creds-file-path": "test.creds", + "subscriptions": [ + { + "subscribe-to": "ee-hpc-nats", + "cluster-tag": "fritz2" + } + ] + } + ], "jwt-public-key": "kzfYrYy+TzpanWZHJ5qSdMj5uKUWgq74BWhQG6copP0=" } \ No newline at end of file diff --git a/internal/api/lineprotocol.go b/internal/api/lineprotocol.go index f675a3a..75d2b20 100644 --- a/internal/api/lineprotocol.go +++ b/internal/api/lineprotocol.go @@ -92,6 +92,10 @@ func ReceiveNats(conf *config.NatsConfig, opts = append(opts, nats.UserInfo(conf.Username, conf.Password)) } + if conf.Credsfilepath != "" { + opts = append(opts, nats.UserCredentials(conf.Credsfilepath)) + } + nc, err := nats.Connect(conf.Address, opts...) if err != nil { return err diff --git a/internal/config/config.go b/internal/config/config.go index b829b5d..4ae3278 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -65,6 +65,9 @@ type NatsConfig struct { Username string `json:"username"` Password string `json:"password"` + //Creds file path + Credsfilepath string `json:"creds-file-path"` + Subscriptions []struct { // Channel name SubscribeTo string `json:"subscribe-to"`