Skip to content

Conversation

@kn100
Copy link
Contributor

@kn100 kn100 commented Nov 13, 2017

No description provided.

@kn100 kn100 requested a review from jameshfisher November 13, 2017 15:18
@kn100 kn100 merged commit aa59c5e into master Nov 13, 2017
@luismfonseca luismfonseca deleted the config-rewrite branch November 13, 2017 17:18

func makeRequest(reqtype string, path string, body []byte) (string, error) {
req, err := http.NewRequest(reqtype, baseEndpoint+path, bytes.NewBuffer(body))
req, err := http.NewRequest(reqtype, viper.GetString("endpoint")+path, bytes.NewBuffer(body))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be coming from the config package so that you abstract the actual configuration backend.

Now the api package is coupled with the exact implementation that powers the configuration (viper).

It's probably a nitpick for a cli project though!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I kind of agree, that's how you're supposed to use Viper, or at least how most of the Go projects that use it seem to. Maybe I'll explore if there's a way to decouple them more cleanly than was done before

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback as always!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'll explore if there's a way to decouple them more cleanly than was done before

I was explaining how you could do this. Just get the information from the config package, without exposing the config backend being used.
You can check our internal project stats-components, for an example of what I'm saying.

fbenevides pushed a commit that referenced this pull request May 3, 2023
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.

3 participants