Skip to content

Commit d00d13d

Browse files
arvindh123dborovcanindraskorodneyosodomanuio
authored
MF-1556 - Move the most used functions in main.go to internal package (#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]>
1 parent ada5813 commit d00d13d

File tree

112 files changed

+3604
-5905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+3604
-5905
lines changed

auth/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ default values.
5757

5858
| Variable | Description | Default |
5959
|-------------------------------|--------------------------------------------------------------------------|----------------|
60-
| MF_AUTH_LOG_LEVEL | Service level (debug, info, warn, error) | error |
60+
| MF_AUTH_LOG_LEVEL | Service level (debug, info, warn, error) | info |
6161
| MF_AUTH_DB_HOST | Database host address | localhost |
6262
| MF_AUTH_DB_PORT | Database host port | 5432 |
6363
| MF_AUTH_DB_USER | Database user | mainflux |

auth/postgres/init.go

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,11 @@
33

44
package postgres
55

6-
import (
7-
"fmt"
6+
import migrate "github.com/rubenv/sql-migrate"
87

9-
_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
10-
"github.com/jmoiron/sqlx"
11-
migrate "github.com/rubenv/sql-migrate"
12-
)
13-
14-
// Config defines the options that are used when connecting to a PostgreSQL instance
15-
type Config struct {
16-
Host string
17-
Port string
18-
User string
19-
Pass string
20-
Name string
21-
SSLMode string
22-
SSLCert string
23-
SSLKey string
24-
SSLRootCert string
25-
}
26-
27-
// Connect creates a connection to the PostgreSQL instance and applies any
28-
// unapplied database migrations. A non-nil error is returned to indicate failure.
29-
func Connect(cfg Config) (*sqlx.DB, error) {
30-
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)
31-
32-
db, err := sqlx.Open("pgx", url)
33-
if err != nil {
34-
return nil, err
35-
}
36-
37-
if err := migrateDB(db); err != nil {
38-
return nil, err
39-
}
40-
return db, nil
41-
}
42-
43-
func migrateDB(db *sqlx.DB) error {
44-
migrations := &migrate.MemoryMigrationSource{
8+
// Migration of Auth service
9+
func Migration() *migrate.MemoryMigrationSource {
10+
return &migrate.MemoryMigrationSource{
4511
Migrations: []*migrate.Migration{
4612
{
4713
Id: "auth_1",
@@ -56,9 +22,9 @@ func migrateDB(db *sqlx.DB) error {
5622
PRIMARY KEY (id, issuer_id)
5723
)`,
5824
`CREATE EXTENSION IF NOT EXISTS LTREE`,
59-
`CREATE TABLE IF NOT EXISTS groups (
25+
`CREATE TABLE IF NOT EXISTS groups (
6026
id VARCHAR(254) UNIQUE NOT NULL,
61-
parent_id VARCHAR(254),
27+
parent_id VARCHAR(254),
6228
owner_id VARCHAR(254),
6329
name VARCHAR(254) NOT NULL,
6430
description VARCHAR(1024),
@@ -80,7 +46,7 @@ func migrateDB(db *sqlx.DB) error {
8046
)`,
8147
`CREATE INDEX path_gist_idx ON groups USING GIST (path);`,
8248
`CREATE OR REPLACE FUNCTION inherit_group()
83-
RETURNS trigger
49+
RETURNS trigger
8450
LANGUAGE PLPGSQL
8551
AS
8652
$$
@@ -112,7 +78,4 @@ func migrateDB(db *sqlx.DB) error {
11278
},
11379
},
11480
}
115-
116-
_, err := migrate.Exec(db.DB, "postgres", migrations, migrate.Up)
117-
return err
11881
}

auth/postgres/setup_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
"os"
1313
"testing"
1414

15-
_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
1615
"github.com/jmoiron/sqlx"
17-
"github.com/mainflux/mainflux/auth/postgres"
16+
authRepo "github.com/mainflux/mainflux/auth/postgres"
17+
pgClient "github.com/mainflux/mainflux/internal/clients/postgres"
1818
dockertest "github.com/ory/dockertest/v3"
1919
)
2020

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

52-
dbConfig := postgres.Config{
52+
dbConfig := pgClient.Config{
5353
Host: "localhost",
5454
Port: port,
5555
User: "test",
@@ -61,7 +61,7 @@ func TestMain(m *testing.M) {
6161
SSLRootCert: "",
6262
}
6363

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

bootstrap/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The service is configured using the environment variables presented in the follo
3737

3838
| Variable | Description | Default |
3939
|-------------------------------|-------------------------------------------------------------------------|----------------------------------|
40-
| MF_BOOTSTRAP_LOG_LEVEL | Log level for Bootstrap (debug, info, warn, error) | error |
40+
| MF_BOOTSTRAP_LOG_LEVEL | Log level for Bootstrap (debug, info, warn, error) | info |
4141
| MF_BOOTSTRAP_DB_HOST | Database host address | localhost |
4242
| MF_BOOTSTRAP_DB_PORT | Database host port | 5432 |
4343
| MF_BOOTSTRAP_DB_USER | Database user | mainflux |
@@ -53,8 +53,7 @@ The service is configured using the environment variables presented in the follo
5353
| MF_BOOTSTRAP_PORT | Bootstrap service HTTP port | 8180 |
5454
| MF_BOOTSTRAP_SERVER_CERT | Path to server certificate in pem format | |
5555
| MF_BOOTSTRAP_SERVER_KEY | Path to server key in pem format | |
56-
| MF_SDK_BASE_URL | Base url for Mainflux SDK | http://localhost |
57-
| MF_SDK_THINGS_PREFIX | SDK prefix for Things service | |
56+
| MF_THINGS_URL | Base url for Mainflux Things | http://localhost |
5857
| MF_THINGS_ES_URL | Things service event source URL | localhost:6379 |
5958
| MF_THINGS_ES_PASS | Things service event source password | |
6059
| MF_THINGS_ES_DB | Things service event source database | 0 |

bootstrap/postgres/init.go

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,11 @@
33

44
package postgres
55

6-
import (
7-
"fmt"
6+
import migrate "github.com/rubenv/sql-migrate"
87

9-
_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
10-
"github.com/jmoiron/sqlx"
11-
migrate "github.com/rubenv/sql-migrate"
12-
)
13-
14-
// Config defines the options that are used when connecting to a PostgreSQL instance
15-
type Config struct {
16-
Host string
17-
Port string
18-
User string
19-
Pass string
20-
Name string
21-
SSLMode string
22-
SSLCert string
23-
SSLKey string
24-
SSLRootCert string
25-
}
26-
27-
// Connect creates a connection to the PostgreSQL instance and applies any
28-
// unapplied database migrations. A non-nil error is returned to indicate
29-
// failure.
30-
func Connect(cfg Config) (*sqlx.DB, error) {
31-
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)
32-
33-
db, err := sqlx.Open("pgx", url)
34-
if err != nil {
35-
return nil, err
36-
}
37-
38-
if err := migrateDB(db); err != nil {
39-
return nil, err
40-
}
41-
42-
return db, nil
43-
}
44-
45-
func migrateDB(db *sqlx.DB) error {
46-
migrations := &migrate.MemoryMigrationSource{
8+
// Migration of bootstrap service
9+
func Migration() *migrate.MemoryMigrationSource {
10+
return &migrate.MemoryMigrationSource{
4711
Migrations: []*migrate.Migration{
4812
{
4913
Id: "configs_1",
@@ -102,8 +66,4 @@ func migrateDB(db *sqlx.DB) error {
10266
},
10367
},
10468
}
105-
106-
_, err := migrate.Exec(db.DB, "postgres", migrations, migrate.Up)
107-
108-
return err
10969
}

bootstrap/postgres/setup_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"os"
99
"testing"
1010

11-
_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
1211
"github.com/jmoiron/sqlx"
13-
"github.com/mainflux/mainflux/bootstrap/postgres"
12+
bootstrapRepo "github.com/mainflux/mainflux/bootstrap/postgres"
13+
pgClient "github.com/mainflux/mainflux/internal/clients/postgres"
1414

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

53-
dbConfig := postgres.Config{
53+
dbConfig := pgClient.Config{
5454
Host: "localhost",
5555
Port: port,
5656
User: "test",
@@ -62,7 +62,7 @@ func TestMain(m *testing.M) {
6262
SSLRootCert: "",
6363
}
6464

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

certs/postgres/certs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"github.com/jackc/pgerrcode"
1313
"github.com/jackc/pgx/v5/pgconn"
14-
_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
14+
1515
"github.com/jmoiron/sqlx"
1616
"github.com/mainflux/mainflux/certs"
1717
"github.com/mainflux/mainflux/logger"

certs/postgres/init.go

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,11 @@
55

66
package postgres
77

8-
import (
9-
"errors"
10-
"fmt"
8+
import migrate "github.com/rubenv/sql-migrate"
119

12-
_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
13-
"github.com/jmoiron/sqlx"
14-
migrate "github.com/rubenv/sql-migrate"
15-
)
16-
17-
const primaryKey = "primary_key"
18-
19-
// ErrMigrate indicates error during database migrations.
20-
var ErrMigrate = errors.New("error executing database migrations")
21-
22-
// Config defines the options that are used when connecting to a PostgreSQL instance
23-
type Config struct {
24-
Host string
25-
Port string
26-
User string
27-
Pass string
28-
Name string
29-
SSLMode string
30-
SSLCert string
31-
SSLKey string
32-
SSLRootCert string
33-
}
34-
35-
// Connect creates a connection to the PostgreSQL instance and applies any
36-
// unapplied database migrations. A non-nil error is returned to indicate
37-
// failure.
38-
func Connect(cfg Config) (*sqlx.DB, error) {
39-
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)
40-
41-
db, err := sqlx.Open("pgx", url)
42-
if err != nil {
43-
return nil, err
44-
}
45-
46-
if err := migrateDB(db); err != nil {
47-
mErr, ok := err.(*migrate.TxError)
48-
if ok && mErr.Migration.Id == primaryKey {
49-
return db, ErrMigrate
50-
}
51-
return nil, err
52-
}
53-
54-
return db, nil
55-
}
56-
57-
func migrateDB(db *sqlx.DB) error {
58-
migrations := &migrate.MemoryMigrationSource{
10+
// Migration of Certs service
11+
func Migration() *migrate.MemoryMigrationSource {
12+
return &migrate.MemoryMigrationSource{
5913
Migrations: []*migrate.Migration{
6014
{
6115
Id: "certs_1",
@@ -74,7 +28,4 @@ func migrateDB(db *sqlx.DB) error {
7428
},
7529
},
7630
}
77-
78-
_, err := migrate.Exec(db.DB, "postgres", migrations, migrate.Up)
79-
return err
8031
}

certs/postgres/setup_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
"github.com/jmoiron/sqlx"
1212
"github.com/mainflux/mainflux/certs/postgres"
13+
pgClient "github.com/mainflux/mainflux/internal/clients/postgres"
1314
"github.com/mainflux/mainflux/logger"
1415
dockertest "github.com/ory/dockertest/v3"
1516
)
@@ -49,7 +50,7 @@ func TestMain(m *testing.M) {
4950
testLog.Error(fmt.Sprintf("Could not connect to docker: %s", err))
5051
}
5152

52-
dbConfig := postgres.Config{
53+
dbConfig := pgClient.Config{
5354
Host: "localhost",
5455
Port: port,
5556
User: "test",
@@ -61,7 +62,7 @@ func TestMain(m *testing.M) {
6162
SSLRootCert: "",
6263
}
6364

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

certs/service.go

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ package certs
55

66
import (
77
"context"
8-
"crypto/tls"
9-
"crypto/x509"
108
"time"
119

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

49-
// Config defines the service parameters
50-
type Config struct {
51-
LogLevel string
52-
ClientTLS bool
53-
CaCerts string
54-
HTTPPort string
55-
ServerCert string
56-
ServerKey string
57-
CertsURL string
58-
JaegerURL string
59-
AuthURL string
60-
AuthTimeout time.Duration
61-
SignTLSCert tls.Certificate
62-
SignX509Cert *x509.Certificate
63-
SignRSABits int
64-
SignHoursValid string
65-
PKIHost string
66-
PKIPath string
67-
PKIRole string
68-
PKIToken string
69-
}
70-
7147
type certsService struct {
7248
auth mainflux.AuthServiceClient
7349
certsRepo Repository
7450
sdk mfsdk.SDK
75-
conf Config
7651
pki pki.Agent
7752
}
7853

79-
// New returns new Certs service.
80-
func New(auth mainflux.AuthServiceClient, certs Repository, sdk mfsdk.SDK, config Config, pki pki.Agent) Service {
54+
// New returns new Certs service
55+
func New(auth mainflux.AuthServiceClient, certs Repository, sdk mfsdk.SDK, pki pki.Agent) Service {
8156
return &certsService{
8257
certsRepo: certs,
8358
sdk: sdk,
8459
auth: auth,
85-
conf: config,
8660
pki: pki,
8761
}
8862
}

0 commit comments

Comments
 (0)