Skip to content
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

Merged
merged 19 commits into from
Jan 24, 2020
Merged

Introduce License client #9

merged 19 commits into from
Jan 24, 2020

Conversation

dborovcanin
Copy link
Member

This pull request resolves #8.

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>
@dborovcanin dborovcanin added the WIP Work in progress label Jan 21, 2020
@dborovcanin dborovcanin self-assigned this Jan 21, 2020
@dborovcanin dborovcanin changed the title Introduce License client (#8) Introduce License client Jan 21, 2020
agent/agent.go Outdated
)

type agent struct {
svc string

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

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"

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)


const (
defLogLevel = "error"
defSvcURL = "localhost:8180"

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

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>
a = api.NewLoggingMiddleware(a, logger)
go a.Do()

a.Load()

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)

go a.Do()

a.Load()
a.Validate([]string{"svc1"})

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)


a.Load()
a.Validate([]string{"svc1"})
a.Save()

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

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)

@dborovcanin dborovcanin removed the WIP Work in progress label Jan 24, 2020
Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
drasko
drasko previously approved these changes Jan 24, 2020
Copy link
Member

@drasko drasko left a 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.
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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>
@manuio manuio deleted the 8 branch January 24, 2020 17:35
dborovcanin added a commit that referenced this pull request Jan 28, 2020
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce License client
3 participants