Skip to content

Commit

Permalink
MF-1556 - Move the most used functions in main.go to internal package (
Browse files Browse the repository at this point in the history
…#1601)

* MF-1525 - Add graceful stop for HTTP and GRPC servers (#1548)

* Add : errgroup to cmd/auth

Signed-off-by: Arvindh <[email protected]>

* Add : Handle graceful stop for auth service
Remove : errgroups from auth service

Signed-off-by: Arvindh <[email protected]>

* Add : Wait till server shutdown

Signed-off-by: Arvindh <[email protected]>

* Change : instead of waitgroup changed to errgroups

Signed-off-by: Arvindh <[email protected]>

* change : KillSignalHandler return type to error

Signed-off-by: Arvindh <[email protected]>

* Empty Commit

Signed-off-by: Arvindh <[email protected]>

* Add : Context to http server shutdown
Rename : varaible from proto to protocol

Signed-off-by: Arvindh <[email protected]>

* change : to default log level

Signed-off-by: Arvindh <[email protected]>

* Add : Sign-off

Signed-off-by: Arvindh <[email protected]>

* Add: graceful stop of http and grpc server

Signed-off-by: Arvindh <[email protected]>

* Fix: typos and caps

Signed-off-by: Arvindh <[email protected]>

* Add: Signed-off

Signed-off-by: Arvindh <[email protected]>

* Rename: Func KillSignalHandler to SignalHandler
Add: SIGABRT

Signed-off-by: Arvindh <[email protected]>

* Fix: auth service

Signed-off-by: Arvindh <[email protected]>

* Add: timeout for grpc gracefulstop
Fix: typos

Signed-off-by: Arvindh <[email protected]>

* Add: .vscode folder to git ignore

Signed-off-by: Arvindh <[email protected]>

* change: variable name to stopWaitTime

Signed-off-by: Arvindh <[email protected]>

* remove: .vscode folder

Signed-off-by: Arvindh <[email protected]>

* remove: .vscode from .gitignore

Signed-off-by: Arvindh <[email protected]>

* Add : logger to handlers

Signed-off-by: Arvindh <[email protected]>

* Add : New line at end of .gitignore file

Signed-off-by: Arvindh <[email protected]>

* Fix : variable naming
Add : graceful stop for timescale

Signed-off-by: Arvindh <[email protected]>

* Remove : unsued NATS library from import

Signed-off-by: Arvindh <[email protected]>

* Move: "https" and "https" to moved to const var

Signed-off-by: Arvindh <[email protected]>

* Move: "http" and "https" to moved to const var

Signed-off-by: Arvindh <[email protected]>

* update:  branch with master

Signed-off-by: Arvindh <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Co-authored-by: Drasko DRASKOVIC <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* Add: httpserver and grpcsever

Signed-off-by: Arvindh <[email protected]>

* MF-1588 - Update Subscriber interface (#1598)

* Initial commit

Signed-off-by: 0x6f736f646f <[email protected]>

* Update subscriber interface

Signed-off-by: dusanb94 <[email protected]>

* Add tests

Signed-off-by: 0x6f736f646f <[email protected]>

* Add tests

Signed-off-by: 0x6f736f646f <[email protected]>

* check subscription map

Signed-off-by: 0x6f736f646f <[email protected]>

* Check topic id after topic

Signed-off-by: 0x6f736f646f <[email protected]>

* reword description

Signed-off-by: 0x6f736f646f <[email protected]>

* Setup empty queue

Signed-off-by: 0x6f736f646f <[email protected]>

* Change mqtt implementation

Signed-off-by: 0x6f736f646f <[email protected]>

* Switch statements

Signed-off-by: 0x6f736f646f <[email protected]>

* Simplify

Signed-off-by: 0x6f736f646f <[email protected]>

* Change mqtt subscriber

Signed-off-by: 0x6f736f646f <[email protected]>

* Protect subscription map

Signed-off-by: 0x6f736f646f <[email protected]>

* Fix subscription

Signed-off-by: 0x6f736f646f <[email protected]>

* Set client id

Signed-off-by: 0x6f736f646f <[email protected]>

* Format

Signed-off-by: 0x6f736f646f <[email protected]>

* Change delete method

Signed-off-by: 0x6f736f646f <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* move http and grpc server functions

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* Move Keto and Jaeger

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* Add metrics and auth

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* MF - 1590 - Fix fetching list of users with a zero limit (#1594)

* Add max and min limit size

Signed-off-by: 0x6f736f646f <[email protected]>

* Format

Signed-off-by: 0x6f736f646f <[email protected]>

* Format

Signed-off-by: 0x6f736f646f <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* NOISSUE - Retrieve client key on cert issuing (#1607)

Signed-off-by: Manuel Imperiale <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* fix bug (#1604)

Signed-off-by: zhangchuanfeng <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* Rename service name

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* Change metrics method

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* Rename

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* Rename

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* Rename package name

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* :truck: Rename Keto and Jaeger functions

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* unify grpc service

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* :truck: rename apiutil to initutil

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* :sparkles: coap server

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* :truck: rename

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* :truck: Rename

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* :recycle: rename packages

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* :recycle: remove mf prefix

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* :truck: rename server error

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* remove dead code

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* MF - 1416 - Queue Abstraction for Mainflux & RabbitMQ Support (#1562)

* MF-1263 - Move repeating errors to the separate package (#1540)

* MF-1263 - Mv duplicated errors to pkg/errors

Signed-off-by: Manuel Imperiale <[email protected]>

* Revert test build flags

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix merge

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix comment

Signed-off-by: Manuel Imperiale <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* NOISSUE - Fix auth members list response (#1555)

* NOISSUE - Fix auth members list response

Signed-off-by: Manuel Imperiale <[email protected]>

* Move group type next to page details

Signed-off-by: Manuel Imperiale <[email protected]>

* Rm membersRes

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix typo

Signed-off-by: Manuel Imperiale <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1261 - Use StatusUnauthorized for authn and StatusForbidden for authz (#1538)

* MF-1261 - Use StatusUnauthorized for authn and StatusForbidden for authz

Signed-off-by: Manuel Imperiale <[email protected]>

* ErrExternalKey typo

Signed-off-by: Manuel Imperiale <[email protected]>

* Rename ErrUnauthorizedAcces -> ErrAuthentication

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix bootstrap error

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix status code in openapi

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix test description

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix test description

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix test description

Signed-off-by: Manuel Imperiale <[email protected]>

* Add errors cases

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix status codes

Signed-off-by: Manuel Imperiale <[email protected]>

* Add gRPC stutus code

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix tests description

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix openapi and encodeError

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix grpc message

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix test descriptions

Signed-off-by: Manuel Imperiale <[email protected]>

* Revert sdk error

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix typo

Signed-off-by: Manuel Imperiale <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1059 - Add TLS support for email (#1560)

* Use gomail package for sending emails

Signed-off-by: Ivan Milosevic <[email protected]>

* remove print err

Signed-off-by: Ivan Milosevic <[email protected]>

* Add vendor

Signed-off-by: Ivan Milosevic <[email protected]>

* Rename email structure
remove logger

Signed-off-by: Ivan Milosevic <[email protected]>

* typo in var name

Signed-off-by: Ivan Milosevic <[email protected]>

* rename var

Signed-off-by: Ivan Milosevic <[email protected]>

* remove MF_EMAIL_SECRET

Signed-off-by: Ivan Milosevic <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* NOISSUE - Refactor MQTT subscriber (#1561)

* correct suscriber interface validator + refactore token error handling

Signed-off-by: tzzed <[email protected]>

* apply review suggestion

Signed-off-by: tzzed <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1257 - Access messages from readers endpoint with user access token (#1470)

* remove owner id

Signed-off-by: Mirko Teodorovic <[email protected]>

* add user auth for db reader

Signed-off-by: mteodor <[email protected]>

* add user auth for db reader

Signed-off-by: mteodor <[email protected]>

* enable mongodb reader for user token reading

Signed-off-by: mteodor <[email protected]>

* use uuid check for auth switch between thing key and user tok

Signed-off-by: mteodor <[email protected]>

* enable user token reading

Signed-off-by: mteodor <[email protected]>

* revert to correct version

Signed-off-by: mteodor <[email protected]>

* fix endpoint test, add additional tests

Signed-off-by: mteodor <[email protected]>

* remove logs,dead code

Signed-off-by: mteodor <[email protected]>

* fix logging messages

Signed-off-by: mteodor <[email protected]>

* remove auth interface, add authorization header type

Signed-off-by: mteodor <[email protected]>

* update api doc

Signed-off-by: mteodor <[email protected]>

* remove unused package

Signed-off-by: mteodor <[email protected]>

* some refactor of cases for authorization switch

Signed-off-by: mteodor <[email protected]>

* correct description in openapi

Signed-off-by: mteodor <[email protected]>

* fix endpoint test to match auth service change

Signed-off-by: mteodor <[email protected]>

* some rename

Signed-off-by: mteodor <[email protected]>

* initialize auth url

Signed-off-by: mteodor <[email protected]>

* add env variables for auth service

Signed-off-by: mteodor <[email protected]>

* fix spelling

Signed-off-by: mteodor <[email protected]>

* Things prefix and no prefix for Thing authorization, Bearer for user

Signed-off-by: mteodor <[email protected]>

* update readme file

Signed-off-by: mteodor <[email protected]>

* fix default things grpc port

Signed-off-by: mteodor <[email protected]>

* enable user reading for timescaledb

Signed-off-by: mteodor <[email protected]>

* remove not used error

Signed-off-by: mteodor <[email protected]>

* improve errors

Signed-off-by: mteodor <[email protected]>

* refactor authorize

Signed-off-by: mteodor <[email protected]>

* add chanID check

Signed-off-by: mteodor <[email protected]>

* inline some error checking

Signed-off-by: mteodor <[email protected]>

* fixing errors

Signed-off-by: mteodor <[email protected]>

* fixing errors

Signed-off-by: mteodor <[email protected]>

* improve test case description

Signed-off-by: mteodor <[email protected]>

* remove test code

Signed-off-by: mteodor <[email protected]>

* dont inline

Signed-off-by: mteodor <[email protected]>

* refactor a bit encodeError

Signed-off-by: mteodor <[email protected]>

* remove unused error

Signed-off-by: mteodor <[email protected]>

* remove unused error

Signed-off-by: mteodor <[email protected]>

* fix things auth grpc url

Signed-off-by: mteodor <[email protected]>

* rename variables for header prefix

Signed-off-by: mteodor <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* Initial commit of adding rabbitmq broker

Signed-off-by: 0x6f736f646f <[email protected]>

* Initial commit of adding rabbitmq broker

Signed-off-by: 0x6f736f646f <[email protected]>

* Initial commit for tests

Signed-off-by: 0x6f736f646f <[email protected]>

* Bump up tests

Signed-off-by: 0x6f736f646f <[email protected]>

* Add more tests

Signed-off-by: 0x6f736f646f <[email protected]>

* Add go routines

Signed-off-by: 0x6f736f646f <[email protected]>

* Initial commit of adding rabbitmq broker

Signed-off-by: 0x6f736f646f <[email protected]>

* Initial commit for tests

Signed-off-by: 0x6f736f646f <[email protected]>

* Bump up tests

Signed-off-by: 0x6f736f646f <[email protected]>

* Add more tests

Signed-off-by: 0x6f736f646f <[email protected]>

* Add go routines

Signed-off-by: 0x6f736f646f <[email protected]>

* Fix tests

Signed-off-by: 0x6f736f646f <[email protected]>

* Fix with wait groups

Signed-off-by: 0x6f736f646f <[email protected]>

* unsubscribe to stop delivering messages

Signed-off-by: 0x6f736f646f <[email protected]>

* Remove exclusivity

Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1551 - Fix Cobra usage commands and clean unnecessary struct types (#1558)

* MF-1551 - Fix Cobra usage commands and clean unnecessary struct types

Signed-off-by: Manuel Imperiale <[email protected]>

* Use linux syntax for cmd usage description

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix typo

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix cmd.Use

Signed-off-by: Manuel Imperiale <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* NOISSUE - Separate Keto hosts for read and write (#1563)

* Separate keto hosts for read and write

Signed-off-by: Ivan Milosevic <[email protected]>

* update readme with new envars

Signed-off-by: Ivan Milosevic <[email protected]>

* rename read connection name

Signed-off-by: Ivan Milosevic <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Co-authored-by: Drasko DRASKOVIC <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* Update dependencies (#1564)

Signed-off-by: dusanb94 <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1240 - Return to service transport layer only service errors (#1559)

* MF-1240 - Return to service transport layer only service errors

Signed-off-by: Manuel Imperiale <[email protected]>

* Remove unecessary errors

Signed-off-by: Manuel Imperiale <[email protected]>

* Rm duplicated errors and fix transport

Signed-off-by: Manuel Imperiale <[email protected]>

* Revert http endpoint_test

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix conflict

Signed-off-by: Manuel Imperiale <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* Implement cancel mechanisms

Signed-off-by: 0x6f736f646f <[email protected]>

* Queuename as parameter

Signed-off-by: 0x6f736f646f <[email protected]>

* Queuename as parameter

Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1469 - Indicate proper authentication scheme in Authorization header (#1523)

* MF-1469 - Indicate proper authentication scheme in Authorization header

Signed-off-by: Stefan Kovacevic <[email protected]>

* Fixing the remarks on the last push

Signed-off-by: Stefan Kovacevic <[email protected]>

* Remove Bearer prefix in all services and fix tests

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix remarks

Signed-off-by: Manuel Imperiale <[email protected]>

Co-authored-by: Manuel Imperiale <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* NOISSUE - Add nats wrapper for COAP (#1569)

* Add nats wrapper for COAP

Signed-off-by: 0x6f736f646f <[email protected]>

* Pass pubsub as argument

Signed-off-by: 0x6f736f646f <[email protected]>

* Defer close connection

Signed-off-by: 0x6f736f646f <[email protected]>

* Defer close connection

Signed-off-by: 0x6f736f646f <[email protected]>

* Rename endpoint to topic

Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1348 - Add transport errors logging (#1544)

* MF-1348 - Add go-kit transport level logging

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix reviews

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix reviews

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix merge

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix remark

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix go test flags

Signed-off-by: Manuel Imperiale <[email protected]>

* Use httputil errors in things and http service

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix SDK tests

Signed-off-by: Manuel Imperiale <[email protected]>

* Use httputil errors in certs and provision service

Signed-off-by: Manuel Imperiale <[email protected]>

* Use httputil errors in consumers service

Signed-off-by: Manuel Imperiale <[email protected]>

* General renaming and add ErrMissingToken

Signed-off-by: Manuel Imperiale <[email protected]>

* Rename httputil -> apiutil and use errors in users servive

Signed-off-by: Manuel Imperiale <[email protected]>

* Use apiutil errors in auth, bootstrap, readers, things and twins

Signed-off-by: Manuel Imperiale <[email protected]>

* Replace errors.Contain by comparison

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix remarks

Signed-off-by: Manuel Imperiale <[email protected]>

* Simplify validateID

Signed-off-by: Manuel Imperiale <[email protected]>

* Simplify validateID

Signed-off-by: Manuel Imperiale <[email protected]>

* Simplify and rename ExtractAuthToken -> ExtractBearerToken

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix readers

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix auth key test and remarks

Signed-off-by: Manuel Imperiale <[email protected]>

* Improve comment

Signed-off-by: Manuel Imperiale <[email protected]>

* Simplify validateUUID check

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix typo

Signed-off-by: Manuel Imperiale <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1567 - Use Bearer, Thing or Basic scheme in Authorization header (#1568)

Signed-off-by: Manuel Imperiale <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1565 - Document Bearer, Thing and Basic Authorization header (#1566)

* MF-1565 - Document Bearer Authorization header

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix auth, bootstrap, http and readers openapi

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix openapi

Signed-off-by: Manuel Imperiale <[email protected]>

* Add enc key for bootstrap

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix typo

Signed-off-by: Manuel Imperiale <[email protected]>

* Use global security

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix bearer formats

Signed-off-by: Manuel Imperiale <[email protected]>

* Polish descriptions

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix boostrap and typo

Signed-off-by: Manuel Imperiale <[email protected]>

Co-authored-by: Drasko DRASKOVIC <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1575 Add 'Name' field to ListMembers response in things svc (#1576)

Signed-off-by: Ivan Balboteo <[email protected]>

Co-authored-by: Ivan Balboteo <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1580 - Influxdb Writer changes format of update-time to string (#1581)

* - MF-1580
- Modified consumers/writers/influxdb/fields.go
- influxdb-writer used to update data type of update-time to string
- Commented line 12 of consumers/writers/influxdb/fields.go to resolve
  uneccessary data type conversion issue

Signed-off-by: Hasan Tariq <[email protected]>

* - MF-1580
- Removed strconv package from consumers/writers/influxdb/fields.go since it is no longer needed
- Removed line 12 from consumers/writers/influxdb/fields.go
- Replaced retrun value of updateTime with msg.UpdateTime (line 16 in
  fields.go)

Signed-off-by: Hasan Tariq <[email protected]>

* Fix InflxuDB readers

Signed-off-by: dusanb94 <[email protected]>

Co-authored-by: Hasan Tariq <[email protected]>
Co-authored-by: dusanb94 <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* NOISSUE - Unify MF_INFLUX_READER_DB_HOST and MF_INFLUX_WRITER_DB_HOST envars (#1585)

Signed-off-by: Manuel Imperiale <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* NOISSUE - Fix CoAP adapter (#1572)

* Revert "NOISSUE - Add nats wrapper for COAP (#1569)"

This reverts commit cc5d5195ab27fa94270ada616487b7053fd9c7bd.

Signed-off-by: dusanb94 <[email protected]>

* Fix CoAP adapter

Signed-off-by: dusanb94 <[email protected]>

* Update CoAP observation cancel

Signed-off-by: dusanb94 <[email protected]>

* Fix observe

Signed-off-by: dusanb94 <[email protected]>

* Fix GET handling

Signed-off-by: dusanb94 <[email protected]>

* Revert authorization

Signed-off-by: dusanb94 <[email protected]>

* Use constants instead of magic numbers

Signed-off-by: dusanb94 <[email protected]>

* Remove an empty line

Signed-off-by: dusanb94 <[email protected]>

* Extract special observe value to constant

Signed-off-by: dusanb94 <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1582 - Fix lora-adapter MQTT client (#1583)

* MF-1582 - Fix lora-adapter MQTT clien

Signed-off-by: Manuel Imperiale <[email protected]>

* Add timeout config to the mqtt subscriber

Signed-off-by: Manuel Imperiale <[email protected]>

* Rm comment

Signed-off-by: Manuel Imperiale <[email protected]>

* Add sub timeout

Signed-off-by: Manuel Imperiale <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* NOISSUE - Update changelog and readme for release 0.13.0 (#1592)

* Update release example

Signed-off-by: dusanb94 <[email protected]>

* Update changelog and examples for 0.13.0 release

Signed-off-by: dusanb94 <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* Update VerneMQ release (#1593)

Signed-off-by: dusanb94 <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* NOISSUE - Update changelog for release 0.13.0 (#1595)

Signed-off-by: dusanb94 <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* unexport constants

Signed-off-by: 0x6f736f646f <[email protected]>

* Change routingkey

Signed-off-by: 0x6f736f646f <[email protected]>

* Remove wait groups

Signed-off-by: 0x6f736f646f <[email protected]>

* protecting map

Signed-off-by: 0x6f736f646f <[email protected]>

* Add publisher to pubsub

Signed-off-by: 0x6f736f646f <[email protected]>

* Change proto library

Signed-off-by: 0x6f736f646f <[email protected]>

* Fix typos

Signed-off-by: 0x6f736f646f <[email protected]>

* Reduce pubsub tests based on implementation

Signed-off-by: 0x6f736f646f <[email protected]>

* Remove channel cancel

Signed-off-by: 0x6f736f646f <[email protected]>

* Export constant

Signed-off-by: 0x6f736f646f <[email protected]>

* NOISSUE - Move invariant statements out of loop for cassandra-writer (#1596)

Signed-off-by: fuzhy <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* Embedding publisher into pubsub

Signed-off-by: 0x6f736f646f <[email protected]>

* Naming publisher

Signed-off-by: 0x6f736f646f <[email protected]>

* NOISSUE - Fix Nginx entrypoint script (#1597)

* Fix Nginx entrypoint script

Signed-off-by: dusanb94 <[email protected]>

* Update dependencies

Signed-off-by: dusanb94 <[email protected]>

* Fix NginX entrypoint

Signed-off-by: dusanb94 <[email protected]>

* Revert Makefile changes

Signed-off-by: dusanb94 <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1525 - Add graceful stop for HTTP and GRPC servers (#1548)

* Add : errgroup to cmd/auth

Signed-off-by: Arvindh <[email protected]>

* Add : Handle graceful stop for auth service
Remove : errgroups from auth service

Signed-off-by: Arvindh <[email protected]>

* Add : Wait till server shutdown

Signed-off-by: Arvindh <[email protected]>

* Change : instead of waitgroup changed to errgroups

Signed-off-by: Arvindh <[email protected]>

* change : KillSignalHandler return type to error

Signed-off-by: Arvindh <[email protected]>

* Empty Commit

Signed-off-by: Arvindh <[email protected]>

* Add : Context to http server shutdown
Rename : varaible from proto to protocol

Signed-off-by: Arvindh <[email protected]>

* change : to default log level

Signed-off-by: Arvindh <[email protected]>

* Add : Sign-off

Signed-off-by: Arvindh <[email protected]>

* Add: graceful stop of http and grpc server

Signed-off-by: Arvindh <[email protected]>

* Fix: typos and caps

Signed-off-by: Arvindh <[email protected]>

* Add: Signed-off

Signed-off-by: Arvindh <[email protected]>

* Rename: Func KillSignalHandler to SignalHandler
Add: SIGABRT

Signed-off-by: Arvindh <[email protected]>

* Fix: auth service

Signed-off-by: Arvindh <[email protected]>

* Add: timeout for grpc gracefulstop
Fix: typos

Signed-off-by: Arvindh <[email protected]>

* Add: .vscode folder to git ignore

Signed-off-by: Arvindh <[email protected]>

* change: variable name to stopWaitTime

Signed-off-by: Arvindh <[email protected]>

* remove: .vscode folder

Signed-off-by: Arvindh <[email protected]>

* remove: .vscode from .gitignore

Signed-off-by: Arvindh <[email protected]>

* Add : logger to handlers

Signed-off-by: Arvindh <[email protected]>

* Add : New line at end of .gitignore file

Signed-off-by: Arvindh <[email protected]>

* Fix : variable naming
Add : graceful stop for timescale

Signed-off-by: Arvindh <[email protected]>

* Remove : unsued NATS library from import

Signed-off-by: Arvindh <[email protected]>

* Move: "https" and "https" to moved to const var

Signed-off-by: Arvindh <[email protected]>

* Move: "http" and "https" to moved to const var

Signed-off-by: Arvindh <[email protected]>

* update:  branch with master

Signed-off-by: Arvindh <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Co-authored-by: Drasko DRASKOVIC <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* MF-1588 - Update Subscriber interface (#1598)

* Initial commit

Signed-off-by: 0x6f736f646f <[email protected]>

* Update subscriber interface

Signed-off-by: dusanb94 <[email protected]>

* Add tests

Signed-off-by: 0x6f736f646f <[email protected]>

* Add tests

Signed-off-by: 0x6f736f646f <[email protected]>

* check subscription map

Signed-off-by: 0x6f736f646f <[email protected]>

* Check topic id after topic

Signed-off-by: 0x6f736f646f <[email protected]>

* reword description

Signed-off-by: 0x6f736f646f <[email protected]>

* Setup empty queue

Signed-off-by: 0x6f736f646f <[email protected]>

* Change mqtt implementation

Signed-off-by: 0x6f736f646f <[email protected]>

* Switch statements

Signed-off-by: 0x6f736f646f <[email protected]>

* Simplify

Signed-off-by: 0x6f736f646f <[email protected]>

* Change mqtt subscriber

Signed-off-by: 0x6f736f646f <[email protected]>

* Protect subscription map

Signed-off-by: 0x6f736f646f <[email protected]>

* Fix subscription

Signed-off-by: 0x6f736f646f <[email protected]>

* Set client id

Signed-off-by: 0x6f736f646f <[email protected]>

* Format

Signed-off-by: 0x6f736f646f <[email protected]>

* Change delete method

Signed-off-by: 0x6f736f646f <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* Update rabbitmq subscriber interface

Signed-off-by: 0x6f736f646f <[email protected]>

* using publisher composition

Signed-off-by: 0x6f736f646f <[email protected]>

* Change contenttype

Signed-off-by: 0x6f736f646f <[email protected]>

* rename topic for publish and subscribe

Signed-off-by: 0x6f736f646f <[email protected]>

* Change errors to lower case

Signed-off-by: 0x6f736f646f <[email protected]>

* Change errors to lower case

Signed-off-by: 0x6f736f646f <[email protected]>

* export errors

Signed-off-by: 0x6f736f646f <[email protected]>

* MF - 1590 - Fix fetching list of users with a zero limit (#1594)

* Add max and min limit size

Signed-off-by: 0x6f736f646f <[email protected]>

* Format

Signed-off-by: 0x6f736f646f <[email protected]>

* Format

Signed-off-by: 0x6f736f646f <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* NOISSUE - Retrieve client key on cert issuing (#1607)

Signed-off-by: Manuel Imperiale <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* fix bug (#1604)

Signed-off-by: zhangchuanfeng <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>

* queue per subscription

Signed-off-by: 0x6f736f646f <[email protected]>

* queue per subscription

Signed-off-by: 0x6f736f646f <[email protected]>

* Change routing method

Signed-off-by: 0x6f736f646f <[email protected]>

* Direct method with one exchange to many queues, one consumer per queue

Signed-off-by: 0x6f736f646f <[email protected]>

* :recycle: Not casting data

Signed-off-by: 0x6f736f646f <[email protected]>

* :pencil2: Fix typo

Signed-off-by: 0x6f736f646f <[email protected]>

* :recycle: remove passed queue name

Signed-off-by: 0x6f736f646f <[email protected]>

* :fire: removing echange kind

Signed-off-by: 0x6f736f646f <[email protected]>

* Combine tests

Signed-off-by: 0x6f736f646f <[email protected]>

* Refactor unsubscribe method

Signed-off-by: 0x6f736f646f <[email protected]>

* Fix merge conflict

Signed-off-by: 0x6f736f646f <[email protected]>

* :white_check_mark: sub and unsub to dummy topic

Signed-off-by: 0x6f736f646f <[email protected]>

* generate client id from topic and ID

Signed-off-by: 0x6f736f646f <[email protected]>

* Rename topicID to clientID

Signed-off-by: 0x6f736f646f <[email protected]>

* update tests

Signed-off-by: 0x6f736f646f <[email protected]>

* Reuse clientID

Signed-off-by: 0x6f736f646f <[email protected]>

* Fix typos

Signed-off-by: 0x6f736f646f <[email protected]>

* Seperate testpublish and testpubsub

Signed-off-by: 0x6f736f646f <[email protected]>

Co-authored-by: Manuel Imperiale <[email protected]>
Co-authored-by: Dušan Borovčanin <[email protected]>
Co-authored-by: Ivan Milošević <[email protected]>
Co-authored-by: __touk__ <[email protected]>
Co-authored-by: Mirko Teodorovic <[email protected]>
Co-authored-by: Drasko DRASKOVIC <[email protected]>
Co-authored-by: stefankovacevic123 <[email protected]>
Co-authored-by: ibalboteo <[email protected]>
Co-authored-by: Ivan Balboteo <[email protected]>
Co-authored-by: Hasan98-git <[email protected]>
Co-authored-by: Hasan Tariq <[email protected]>
Co-authored-by: fuzhy <[email protected]>
Co-authored-by: Arvindh <[email protected]>
Co-authored-by: 张传峰 <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* NOISSUE - Fix Groups SDK (#1609)

* Fix Groups SDK

Signed-off-by: dusanb94 <[email protected]>

* Fix CLI

Signed-off-by: dusanb94 <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* NOISSUE - Fix CI script (#1613)

* Fix CI script

Signed-off-by: dusanb94 <[email protected]>

* Fix linter errors

Signed-off-by: dusanb94 <[email protected]>

* Add timeout to linter

Signed-off-by: dusanb94 <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* NOISSUE - Make application/json content-type valid in http-adapter (#1606)

* NOISSUE - Make application/json content-type valid in http-adapter

Signed-off-by: Manuel Imperiale <[email protected]>

* Add test

Signed-off-by: Manuel Imperiale <[email protected]>

* Add CBOR content-type

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix naming

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix naming

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix CI

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix CI flag

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix CI install

Signed-off-by: Manuel Imperiale <[email protected]>

* Upgrade grpc version

Signed-off-by: Manuel Imperiale <[email protected]>

* Fix typo

Signed-off-by: Manuel Imperiale <[email protected]>

* rm cli

Signed-off-by: Manuel Imperiale <[email protected]>

Co-authored-by: Dušan Borovčanin <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* Specify size of channel

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* NOISSUE - fix pull request template typo (#1616)

* Fix typo

Signed-off-by: Filip Bugarski <[email protected]>

* Change link

Signed-off-by: fbugarski <[email protected]>
Signed-off-by: Arvindh <[email protected]>

* Add: load configuration function

Signed-off-by: Arvindh <[email protected]>

* change: load config from env with pkg caarlos0/env

Signed-off-by: Arvindh <[email protected]>

* change: mfdatabase to internaldb

Signed-off-by: Arvindh <[email protected]>

* Add: httpserver and grpcsever

Signed-off-by: Arvindh <[email protected]>

move http and grpc server functions

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

Move Keto and Jaeger

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

Add metrics and auth

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

Rename service name

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

Change metrics method

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

Rename

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

Rename

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

Rename package name

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

:truck: Rename Keto and Jaeger functions

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

unify grpc service

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

:truck: rename apiutil to initutil

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

:sparkles: coap server

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

:truck: rename

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

:truck: Rename

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

:recycle: rename packages

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

:recycle: remove mf prefix

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

:truck: rename server error

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

remove dead code

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

NOISSUE - Fix CI script (#1613)

* Fix CI script

Signed-off-by: dusanb94 <[email protected]>

* Fix linter errors

Signed-off-by: dusanb94 <[email protected]>

* Add timeout to linter

Signed-off-by: dusanb94 <[email protected]>
Signed-off-by: Arvindh <[email protected]>

Specify size of channel

Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Arvindh <[email protected]>

Add: load configuration function

Signed-off-by: Arvindh <[email protected]>

change: load config from env with pkg caarlos0/env

Signed-off-by: Arvindh <[email protected]>

* change: mfdatabase to internaldb

Signed-off-by: Arvindh <[email protected]>

* fix: merge resolve error

Signed-off-by: Arvindh <[email protected]>

* fix: merge resolve error

Signed-off-by: Arvindh <[email protected]>

* fix: merge resolve error

Signed-off-by: Arvindh <[email protected]>

* remove: unused variables

Signed-off-by: Arvindh <[email protected]>

* add: address variable in servers

Signed-off-by: Arvindh <[email protected]>

* move: postgres connect to internal

Signed-off-by: Arvindh <[email protected]>

* add: client wrapper for most used

Signed-off-by: Arvindh <[email protected]>

* add: client wrapper for env

Signed-off-by: Arvindh <[email protected]>

* unify : auth, bootstrap, cassandra reader

Signed-off-by: Arvindh <[email protected]>

* unify : bootstrap code

Signed-off-by: Arvindh <[email protected]>

* unify : cassandra writer

Signed-off-by: Arvindh <[email protected]>

* fix: struct tag to envDefault

Signed-off-by: Arvindh <[email protected]>

* fix: grpc prefix

Signed-off-by: Arvindh <[email protected]>

* fix: env parser

Signed-off-by: Arvindh <[email protected]>

* fix: alt prefix

Signed-off-by: Arvindh <[email protected]>

* fix: env default tag

Signed-off-by: Arvindh <[email protected]>

* fix: auth grpc config

Signed-off-by: Arvindh <[email protected]>

* changes: internal approch and service start

Signed-off-by: Arvindh <[email protected]>

* unify: http adapter service

Signed-off-by: Arvindh <[email protected]>

* remove: unused code in http adapter"

Signed-off-by: Arvindh <[email protected]>

* fix: config environment variable tags

Signed-off-by: Arvindh <[email protected]>

* unify: timescale writer

Signed-off-by: Arvindh <[email protected]>

* unify: timescale reader

Signed-off-by: Arvindh <[email protected]>

* unify: thing main.go

Signed-off-by: Arvindh <[email protected]>

* unify: smtp-notifier

Signed-off-by: Arvindh <[email protected]>

* unify: smpp-notifier

Signed-off-by: Arvindh <[email protected]>

* unify: postgres reader and writer

Signed-off-by: Arvindh <[email protected]>

* unify: twins

Signed-off-by: Arvindh <[email protected]>

* unify

Signed-off-by: Arvindh <[email protected]>

* unify certs main.go

Signed-off-by: Arvindh <[email protected]>

* unify certs main.go

Signed-off-by: Arvindh <[email protected]>

* unify coap main.go

Signed-off-by: Arvindh <[email protected]>

* unify lora main.go

Signed-off-by: Arvindh <[email protected]>

* fix fatalf

Signed-off-by: Arvindh <[email protected]>

* unify mqtt main.go

Signed-off-by: Arvindh <[email protected]>

* unify mqtt main.go

Signed-off-by: Arvindh <[email protected]>

* unify ocpua adapter main.go

Signed-off-by: Arvindh <[email protected]>

* fix case

Signed-off-by: Arvindh <[email protected]>

* unify ws_adapter

Signed-off-by: Arvindh <[email protected]>

* unify ws_adapter

Signed-off-by: Arvindh <[email protected]>

* unify ws_adapter

Signed-off-by: Arvindh <[email protected]>

* add : comment and spacing

Signed-off-by: Arvindh <[email protected]>

* fix: lint errors

Signed-off-by: Arvindh <[email protected]>

* fix: lint errors

Signed-off-by: Arvindh <[email protected]>

* fix: main.go config load

Signed-off-by: Arvindh <[email protected]>

* fix: main.go config load

Signed-off-by: Arvindh <[email protected]>

* fix: auth main.go keto config

Signed-off-by: Arvindh <[email protected]>

* remove: package internal/sqlxt

Signed-off-by: Arvindh <[email protected]>

* code format : internal/client/grpc/connect.go

Signed-off-by: Arvindh <[email protected]>

* fix: inline code

Signed-off-by: Arvindh <[email protected]>

* fix: code format

Signed-off-by: Arvindh <[email protected]>

* fix: inline and code format

Signed-off-by: Arvindh <[email protected]>

* fix: moved to single block

Signed-off-by: Arvindh <[email protected]>

* fix: moved to single block

Signed-off-by: Arvindh <[email protected]>

* fix: export function comments

Signed-off-by: Arvindh <[email protected]>

* fix: export function comments

Signed-off-by: Arvindh <[email protected]>

* fix: export function comments

Signed-off-by: Arvindh <[email protected]>

* fix: export function comments

Signed-off-by: Arvindh <[email protected]>

* fix: export function comments

Signed-off-by: Arvindh <[email protected]>

* remane: newtracer.go to tracer.go

Signed-off-by: Arvindh <[email protected]>

* renamee: authClient.go and thingsClient.go to client.go

Signed-off-by: Arvindh <[email protected]>

* remove space

Signed-off-by: Arvindh <[email protected]>

* add: jaeger default value

Signed-off-by: Arvindh <[email protected]>

* fix: cassander config default values

Signed-off-by: Arvindh <[email protected]>

* rename file

Signed-off-by: Arvindh <[email protected]>

* fix: postgres client config default values

Signed-off-by: Arvindh <[email protected]>

* add setup with default config

Signed-off-by: Arvindh <[email protected]>

* fix: mongo client config default values

Signed-off-by: Arvindh <[email protected]>

* add: postgres default db name in services

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for auth

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for bootstrap

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for cassandra-reader

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for cassandra-writer

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for certs

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for coap

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for http-adapter

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for influx-reader

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for influx-writer

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for lora

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for mongodb-reader

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for mongodb-writer

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for mqtt

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for opcua

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for postgres-reader

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for postgres-writer

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for smpp-notifier

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for smtp-notifier

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for things

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for timescale-reader

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for timescale-writer

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for twins

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for users

Signed-off-by: Arvindh <[email protected]>

* fix: environment variable default for ws

Signed-off-by: Arvindh <[email protected]>

* fix: unused variables

Signed-off-by: Arvindh <[email protected]>

* empty commit

Signed-off-by: Arvindh <[email protected]>

* add comments

Signed-off-by: Arvindh <[email protected]>

* fix: redis env variables

Signed-off-by: Arvindh <[email protected]>

* fix: adapter ports and postgres db name

Signed-off-by: Arvindh <[email protected]>

* fix: adapter ports

Signed-off-by: Arvindh <[email protected]>

* comments aligned

Signed-off-by: Arvindh <[email protected]>

* rename cassandra session variable

Signed-off-by: Arvindh <[email protected]>

* rename influxdb and influx to influxDB

Signed-off-by: Arvindh <[email protected]>

* rename EsConsumername to ESConsumerName

Signed-off-by: Arvindh <[email protected]>

* made comments consistant

Signed-off-by: Arvindh <[email protected]>

* made comments consistant & remove empty lines

Signed-off-by: Arvindh <[email protected]>

* made comments consistant & renmae function

Signed-off-by: Arvindh <[email protected]>

* made comments

Signed-off-by: Arvindh <[email protected]>

* comments added

Signed-off-by: Arvindh <[email protected]>

* fix bootstrap

Signed-off-by: Arvindh <[email protected]>

* fix empty env var

Signed-off-by: Arvindh <[email protected]>

* remove : unused variable

Signed-off-by: Arvindh <[email protected]>

* update: env parser library

Signed-off-by: Arvindh <[email protected]>

* fix: mongodb reader and writer

Signed-off-by: Arvindh <[email protected]>

* fix: cassandra reader and writer

Signed-off-by: Arvindh <[email protected]>

* rename: directory

Signed-off-by: Arvindh <[email protected]>

* rename: variable

Signed-off-by: Arvindh <[email protected]>

* remove: unused librar

Signed-off-by: Arvindh <[email protected]>

* Format code and remove unused comments

Signed-off-by: dusanb94 <[email protected]>

* Fix tests

Signed-off-by: dusanb94 <[email protected]>

* Move test URL construction out of the loop

Signed-off-by: dusanb94 <[email protected]>

* remove end dot in single line comments

Signed-off-by: Arvindh <[email protected]>

* empty

Signed-off-by: Arvindh <[email protected]>

---------

Signed-off-by: Arvindh <[email protected]>
Signed-off-by: 0x6f736f646f <[email protected]>
Signed-off-by: Manuel Imperiale <[email protected]>
Signed-off-by: zhangchuanfeng <[email protected]>
Signed-off-by: dusanb94 <[email protected]>
Signed-off-by: fbugarski <[email protected]>
Co-authored-by: Dušan Borovčanin <[email protected]>
Co-authored-by: Drasko DRASKOVIC <[email protected]>
Co-authored-by: b1ackd0t <[email protected]>
Co-authored-by: Manuel Imperiale <[email protected]>
Co-authored-by: 张传峰 <[email protected]>
Co-authored-by: Ivan Milošević <[email protected]>
Co-authored-by: __touk__ <[email protected]>
Co-authored-by: Mirko Teodorovic <[email protected]>
Co-authored-by: stefankovacevic123 <[email protected]>
Co-authored-by: ibalboteo <[email protected]>
Co-authored-by: Ivan Balboteo <[email protected]>
Co-authored-by: Hasan98-git <[email protected]>
Co-authored-by: Hasan Tariq <[email protected]>
Co-authored-by: fuzhy <[email protected]>
Co-authored-by: Filip Bugarski <[email protected]>
  • Loading branch information
16 people authored Feb 3, 2023
1 parent ada5813 commit d00d13d
Show file tree
Hide file tree
Showing 112 changed files with 3,604 additions and 5,905 deletions.
2 changes: 1 addition & 1 deletion auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ default values.

| Variable | Description | Default |
|-------------------------------|--------------------------------------------------------------------------|----------------|
| MF_AUTH_LOG_LEVEL | Service level (debug, info, warn, error) | error |
| MF_AUTH_LOG_LEVEL | Service level (debug, info, warn, error) | info |
| MF_AUTH_DB_HOST | Database host address | localhost |
| MF_AUTH_DB_PORT | Database host port | 5432 |
| MF_AUTH_DB_USER | Database user | mainflux |
Expand Down
51 changes: 7 additions & 44 deletions auth/postgres/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,11 @@

package postgres

import (
"fmt"
import migrate "github.com/rubenv/sql-migrate"

_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
"github.com/jmoiron/sqlx"
migrate "github.com/rubenv/sql-migrate"
)

// Config defines the options that are used when connecting to a PostgreSQL instance
type Config struct {
Host string
Port string
User string
Pass string
Name string
SSLMode string
SSLCert string
SSLKey string
SSLRootCert string
}

// Connect creates a connection to the PostgreSQL instance and applies any
// unapplied database migrations. A non-nil error is returned to indicate failure.
func Connect(cfg Config) (*sqlx.DB, error) {
url := fmt.Sprintf("host=%s port=%s user=%s dbname=%s password=%s sslmode=%s sslcert=%s sslkey=%s sslrootcert=%s", cfg.Host, cfg.Port, cfg.User, cfg.Name, cfg.Pass, cfg.SSLMode, cfg.SSLCert, cfg.SSLKey, cfg.SSLRootCert)

db, err := sqlx.Open("pgx", url)
if err != nil {
return nil, err
}

if err := migrateDB(db); err != nil {
return nil, err
}
return db, nil
}

func migrateDB(db *sqlx.DB) error {
migrations := &migrate.MemoryMigrationSource{
// Migration of Auth service
func Migration() *migrate.MemoryMigrationSource {
return &migrate.MemoryMigrationSource{
Migrations: []*migrate.Migration{
{
Id: "auth_1",
Expand All @@ -56,9 +22,9 @@ func migrateDB(db *sqlx.DB) error {
PRIMARY KEY (id, issuer_id)
)`,
`CREATE EXTENSION IF NOT EXISTS LTREE`,
`CREATE TABLE IF NOT EXISTS groups (
`CREATE TABLE IF NOT EXISTS groups (
id VARCHAR(254) UNIQUE NOT NULL,
parent_id VARCHAR(254),
parent_id VARCHAR(254),
owner_id VARCHAR(254),
name VARCHAR(254) NOT NULL,
description VARCHAR(1024),
Expand All @@ -80,7 +46,7 @@ func migrateDB(db *sqlx.DB) error {
)`,
`CREATE INDEX path_gist_idx ON groups USING GIST (path);`,
`CREATE OR REPLACE FUNCTION inherit_group()
RETURNS trigger
RETURNS trigger
LANGUAGE PLPGSQL
AS
$$
Expand Down Expand Up @@ -112,7 +78,4 @@ func migrateDB(db *sqlx.DB) error {
},
},
}

_, err := migrate.Exec(db.DB, "postgres", migrations, migrate.Up)
return err
}
8 changes: 4 additions & 4 deletions auth/postgres/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"os"
"testing"

_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
"github.com/jmoiron/sqlx"
"github.com/mainflux/mainflux/auth/postgres"
authRepo "github.com/mainflux/mainflux/auth/postgres"
pgClient "github.com/mainflux/mainflux/internal/clients/postgres"
dockertest "github.com/ory/dockertest/v3"
)

Expand Down Expand Up @@ -49,7 +49,7 @@ func TestMain(m *testing.M) {
log.Fatalf("Could not connect to docker: %s", err)
}

dbConfig := postgres.Config{
dbConfig := pgClient.Config{
Host: "localhost",
Port: port,
User: "test",
Expand All @@ -61,7 +61,7 @@ func TestMain(m *testing.M) {
SSLRootCert: "",
}

if db, err = postgres.Connect(dbConfig); err != nil {
if db, err = pgClient.SetupDB(dbConfig, *authRepo.Migration()); err != nil {
log.Fatalf("Could not setup test DB connection: %s", err)
}

Expand Down
5 changes: 2 additions & 3 deletions bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The service is configured using the environment variables presented in the follo

| Variable | Description | Default |
|-------------------------------|-------------------------------------------------------------------------|----------------------------------|
| MF_BOOTSTRAP_LOG_LEVEL | Log level for Bootstrap (debug, info, warn, error) | error |
| MF_BOOTSTRAP_LOG_LEVEL | Log level for Bootstrap (debug, info, warn, error) | info |
| MF_BOOTSTRAP_DB_HOST | Database host address | localhost |
| MF_BOOTSTRAP_DB_PORT | Database host port | 5432 |
| MF_BOOTSTRAP_DB_USER | Database user | mainflux |
Expand All @@ -53,8 +53,7 @@ The service is configured using the environment variables presented in the follo
| MF_BOOTSTRAP_PORT | Bootstrap service HTTP port | 8180 |
| MF_BOOTSTRAP_SERVER_CERT | Path to server certificate in pem format | |
| MF_BOOTSTRAP_SERVER_KEY | Path to server key in pem format | |
| MF_SDK_BASE_URL | Base url for Mainflux SDK | http://localhost |
| MF_SDK_THINGS_PREFIX | SDK prefix for Things service | |
| MF_THINGS_URL | Base url for Mainflux Things | http://localhost |
| MF_THINGS_ES_URL | Things service event source URL | localhost:6379 |
| MF_THINGS_ES_PASS | Things service event source password | |
| MF_THINGS_ES_DB | Things service event source database | 0 |
Expand Down
48 changes: 4 additions & 44 deletions bootstrap/postgres/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,11 @@

package postgres

import (
"fmt"
import migrate "github.com/rubenv/sql-migrate"

_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
"github.com/jmoiron/sqlx"
migrate "github.com/rubenv/sql-migrate"
)

// Config defines the options that are used when connecting to a PostgreSQL instance
type Config struct {
Host string
Port string
User string
Pass string
Name string
SSLMode string
SSLCert string
SSLKey string
SSLRootCert string
}

// Connect creates a connection to the PostgreSQL instance and applies any
// unapplied database migrations. A non-nil error is returned to indicate
// failure.
func Connect(cfg Config) (*sqlx.DB, error) {
url := fmt.Sprintf("host=%s port=%s user=%s dbname=%s password=%s sslmode=%s sslcert=%s sslkey=%s sslrootcert=%s", cfg.Host, cfg.Port, cfg.User, cfg.Name, cfg.Pass, cfg.SSLMode, cfg.SSLCert, cfg.SSLKey, cfg.SSLRootCert)

db, err := sqlx.Open("pgx", url)
if err != nil {
return nil, err
}

if err := migrateDB(db); err != nil {
return nil, err
}

return db, nil
}

func migrateDB(db *sqlx.DB) error {
migrations := &migrate.MemoryMigrationSource{
// Migration of bootstrap service
func Migration() *migrate.MemoryMigrationSource {
return &migrate.MemoryMigrationSource{
Migrations: []*migrate.Migration{
{
Id: "configs_1",
Expand Down Expand Up @@ -102,8 +66,4 @@ func migrateDB(db *sqlx.DB) error {
},
},
}

_, err := migrate.Exec(db.DB, "postgres", migrations, migrate.Up)

return err
}
8 changes: 4 additions & 4 deletions bootstrap/postgres/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"os"
"testing"

_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
"github.com/jmoiron/sqlx"
"github.com/mainflux/mainflux/bootstrap/postgres"
bootstrapRepo "github.com/mainflux/mainflux/bootstrap/postgres"
pgClient "github.com/mainflux/mainflux/internal/clients/postgres"

"github.com/mainflux/mainflux/logger"
dockertest "github.com/ory/dockertest/v3"
Expand Down Expand Up @@ -50,7 +50,7 @@ func TestMain(m *testing.M) {
testLog.Error(fmt.Sprintf("Could not connect to docker: %s", err))
}

dbConfig := postgres.Config{
dbConfig := pgClient.Config{
Host: "localhost",
Port: port,
User: "test",
Expand All @@ -62,7 +62,7 @@ func TestMain(m *testing.M) {
SSLRootCert: "",
}

if db, err = postgres.Connect(dbConfig); err != nil {
if db, err = pgClient.SetupDB(dbConfig, *bootstrapRepo.Migration()); err != nil {
testLog.Error(fmt.Sprintf("Could not setup test DB connection: %s", err))
}

Expand Down
2 changes: 1 addition & 1 deletion certs/postgres/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/jackc/pgerrcode"
"github.com/jackc/pgx/v5/pgconn"
_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access

"github.com/jmoiron/sqlx"
"github.com/mainflux/mainflux/certs"
"github.com/mainflux/mainflux/logger"
Expand Down
57 changes: 4 additions & 53 deletions certs/postgres/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,11 @@

package postgres

import (
"errors"
"fmt"
import migrate "github.com/rubenv/sql-migrate"

_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
"github.com/jmoiron/sqlx"
migrate "github.com/rubenv/sql-migrate"
)

const primaryKey = "primary_key"

// ErrMigrate indicates error during database migrations.
var ErrMigrate = errors.New("error executing database migrations")

// Config defines the options that are used when connecting to a PostgreSQL instance
type Config struct {
Host string
Port string
User string
Pass string
Name string
SSLMode string
SSLCert string
SSLKey string
SSLRootCert string
}

// Connect creates a connection to the PostgreSQL instance and applies any
// unapplied database migrations. A non-nil error is returned to indicate
// failure.
func Connect(cfg Config) (*sqlx.DB, error) {
url := fmt.Sprintf("host=%s port=%s user=%s dbname=%s password=%s sslmode=%s sslcert=%s sslkey=%s sslrootcert=%s", cfg.Host, cfg.Port, cfg.User, cfg.Name, cfg.Pass, cfg.SSLMode, cfg.SSLCert, cfg.SSLKey, cfg.SSLRootCert)

db, err := sqlx.Open("pgx", url)
if err != nil {
return nil, err
}

if err := migrateDB(db); err != nil {
mErr, ok := err.(*migrate.TxError)
if ok && mErr.Migration.Id == primaryKey {
return db, ErrMigrate
}
return nil, err
}

return db, nil
}

func migrateDB(db *sqlx.DB) error {
migrations := &migrate.MemoryMigrationSource{
// Migration of Certs service
func Migration() *migrate.MemoryMigrationSource {
return &migrate.MemoryMigrationSource{
Migrations: []*migrate.Migration{
{
Id: "certs_1",
Expand All @@ -74,7 +28,4 @@ func migrateDB(db *sqlx.DB) error {
},
},
}

_, err := migrate.Exec(db.DB, "postgres", migrations, migrate.Up)
return err
}
5 changes: 3 additions & 2 deletions certs/postgres/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/jmoiron/sqlx"
"github.com/mainflux/mainflux/certs/postgres"
pgClient "github.com/mainflux/mainflux/internal/clients/postgres"
"github.com/mainflux/mainflux/logger"
dockertest "github.com/ory/dockertest/v3"
)
Expand Down Expand Up @@ -49,7 +50,7 @@ func TestMain(m *testing.M) {
testLog.Error(fmt.Sprintf("Could not connect to docker: %s", err))
}

dbConfig := postgres.Config{
dbConfig := pgClient.Config{
Host: "localhost",
Port: port,
User: "test",
Expand All @@ -61,7 +62,7 @@ func TestMain(m *testing.M) {
SSLRootCert: "",
}

if db, err = postgres.Connect(dbConfig); err != nil {
if db, err = pgClient.SetupDB(dbConfig, *postgres.Migration()); err != nil {
testLog.Error(fmt.Sprintf("Could not setup test DB connection: %s", err))
}

Expand Down
30 changes: 2 additions & 28 deletions certs/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ package certs

import (
"context"
"crypto/tls"
"crypto/x509"
"time"

"github.com/mainflux/mainflux"
Expand Down Expand Up @@ -46,43 +44,19 @@ type Service interface {
RevokeCert(ctx context.Context, token, serialID string) (Revoke, error)
}

// Config defines the service parameters
type Config struct {
LogLevel string
ClientTLS bool
CaCerts string
HTTPPort string
ServerCert string
ServerKey string
CertsURL string
JaegerURL string
AuthURL string
AuthTimeout time.Duration
SignTLSCert tls.Certificate
SignX509Cert *x509.Certificate
SignRSABits int
SignHoursValid string
PKIHost string
PKIPath string
PKIRole string
PKIToken string
}

type certsService struct {
auth mainflux.AuthServiceClient
certsRepo Repository
sdk mfsdk.SDK
conf Config
pki pki.Agent
}

// New returns new Certs service.
func New(auth mainflux.AuthServiceClient, certs Repository, sdk mfsdk.SDK, config Config, pki pki.Agent) Service {
// New returns new Certs service
func New(auth mainflux.AuthServiceClient, certs Repository, sdk mfsdk.SDK, pki pki.Agent) Service {
return &certsService{
certsRepo: certs,
sdk: sdk,
auth: auth,
conf: config,
pki: pki,
}
}
Expand Down
Loading

0 comments on commit d00d13d

Please sign in to comment.