-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MF-708 - Assign Writer(s) to a channel #737
Conversation
Add support for channel filtering using yaml configuration files for writers. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
Codecov Report
@@ Coverage Diff @@
## master #737 +/- ##
==========================================
- Coverage 85.29% 85.08% -0.21%
==========================================
Files 66 66
Lines 4216 4232 +16
==========================================
+ Hits 3596 3601 +5
- Misses 416 430 +14
+ Partials 204 201 -3
Continue to review full report at Codecov.
|
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use TOML, as it is official config method of Mainflux. Also, please provide some documentation about the feature.
cmd/cassandra-writer/main.go
Outdated
defPort = "8180" | ||
defCluster = "127.0.0.1" | ||
defKeyspace = "mainflux" | ||
defChanCfgPath = "/config/channels.yaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use TOML for all our configs in Mainflux.
cmd/influxdb-writer/main.go
Outdated
@@ -41,6 +43,7 @@ const ( | |||
defDBPort = "8086" | |||
defDBUser = "mainflux" | |||
defDBPass = "mainflux" | |||
defChanCfgPath = "/config/channels.yaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TOML
cmd/mongodb-writer/main.go
Outdated
defDBName = "mainflux" | ||
defDBHost = "localhost" | ||
defDBPort = "27017" | ||
defChanCfgPath = "/config/channels.yaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TOML
cmd/postgres-writer/main.go
Outdated
@@ -42,6 +44,7 @@ const ( | |||
defDBSSLCert = "" | |||
defDBSSLKey = "" | |||
defDBSSLRootCert = "" | |||
defChanCfgPath = "/config/channels.yaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TOML
@drasko I've updated README files and added doc comments in the configuration itself. I didn't know that we had any config files in Mainflux, especially TOML. Can you send me an example? |
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
@@ -0,0 +1,4 @@ | |||
# If you want to listen on all channels, just pass one element ["*"], otherwise | |||
# pass the list of channels. | |||
[channels] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a special table for this config? Would there be any other setting for channels except filter
? I.e. would just
channels = [...]
do the job?
Moreover, if all that we need is alist of channels, maybe we do not need even TOML? Maybe a simplle file with one channel ID per line is enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked about adding support for configuration for every service (instead of using current env vars). That's why I added it as a separate table (this config will grow, and in the end, this config will create a lot of other fields). We can use simple file, but I would keep standard config format (especially because this config will grow).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Add support for channel filtering using config Add support for channel filtering using yaml configuration files for writers. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update writers documentation with new env var Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add info comment to configuration file Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix configuration and update yaml dep Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update config from yaml to toml Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add support for channel filtering using config Add support for channel filtering using yaml configuration files for writers. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update writers documentation with new env var Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add info comment to configuration file Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix configuration and update yaml dep Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update config from yaml to toml Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add support for channel filtering using config Add support for channel filtering using yaml configuration files for writers. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update writers documentation with new env var Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add info comment to configuration file Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix configuration and update yaml dep Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update config from yaml to toml Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add support for channel filtering using config Add support for channel filtering using yaml configuration files for writers. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update writers documentation with new env var Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add info comment to configuration file Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix configuration and update yaml dep Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update config from yaml to toml Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
* Add support for channel filtering using config Add support for channel filtering using yaml configuration files for writers. Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update writers documentation with new env var Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Add info comment to configuration file Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Fix configuration and update yaml dep Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com> * Update config from yaml to toml Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
What does this do?
Adds the configuration file with the list of channels. Writers will only persist messages from specified channels.
Which issue(s) does this PR fix/relate to?
Resolves #708.
List any changes that modify/break current functionality
Configuration should be specified in order to persist messages from channels.
Have you included tests for your changes?
No.
Did you document any new/modified functionality?
Yes, I've updated README files.