-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce License client #9
Conversation
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Introduce licensing agent. Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
agent/agent.go
Outdated
) | ||
|
||
type agent struct { | ||
svc string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
field svc
is unused (from unused
)
|
||
type config struct { | ||
logLevel string | ||
svcURL string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
field svcURL
is unused (from unused
)
defServerCert = "" | ||
|
||
envLogLevel = "MF_LICENSE_LOG_LEVEL" | ||
envSvcURL = "MF_LICENSE_SERVICE_URL" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
envSvcURL
is unused (from varcheck
)
cmd/agent/main.go
Outdated
|
||
const ( | ||
defLogLevel = "error" | ||
defSvcURL = "localhost:8180" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defSvcURL
is unused (from varcheck
)
agent/crypto.go
Outdated
} | ||
|
||
func mid(b string) (a string) { | ||
a = b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SA4006: this value of a
is never used (from staticcheck
)
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
cmd/agent/main.go
Outdated
a = api.NewLoggingMiddleware(a, logger) | ||
go a.Do() | ||
|
||
a.Load() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of a.Load
is not checked (from errcheck
)
cmd/agent/main.go
Outdated
go a.Do() | ||
|
||
a.Load() | ||
a.Validate([]string{"svc1"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of a.Validate
is not checked (from errcheck
)
cmd/agent/main.go
Outdated
|
||
a.Load() | ||
a.Validate([]string{"svc1"}) | ||
a.Save() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of a.Save
is not checked (from errcheck
)
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
} | ||
|
||
func mid(b string) (ret string) { | ||
ret = b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SA4006: this value of ret
is never used (from staticcheck
)
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good, just that I would suggest reorganization of the repo to fit Go project layout.
I will approve and let you open the issue for this reorganization.
.gitignore
Outdated
@@ -1 +1,5 @@ | |||
# Build dir contains bineries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
binaries
@@ -0,0 +1,24 @@ | |||
// Copyright (c) Mainflux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are files like this put in the root?
I am not sure that this follows these recommendations: https://github.com/golang-standards/project-layout
@@ -0,0 +1,181 @@ | |||
// Copyright (c) Mainflux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should go in pkg
probably
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
* Add client interface Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Create Agent interface Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Update project layout Introduce licensing agent. Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Add watch method to Agent Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Add comments to exported errors Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Add main method for Agent Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Remove commented code Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Add logging middleware Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Use channels and commands for synchronization Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Fix GitHub flow Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Fix Agent interface Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Handler non-existing license file Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Close channel by sender, not receiver Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Remove buffer size from error and command channels Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Use single errors channel Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Use HTTP client to get a License from the cloud Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Add cloud URL to configuration Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Remove Fetch method Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Fix typo in .gitignore Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
This pull request resolves #8.