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

refactor(config): RPC > HTTP & API for config #1671

Merged
merged 1 commit into from Mar 5, 2021
Merged

Conversation

Arqu
Copy link
Contributor

@Arqu Arqu commented Mar 4, 2021

Part of #1675

@Arqu Arqu added API JSON API issues RPC remote procedure call issues labels Mar 4, 2021
@Arqu Arqu requested review from b5 and dustmop March 4, 2021 14:31
@Arqu Arqu self-assigned this Mar 4, 2021
@Arqu Arqu added this to In progress in Sprints via automation Mar 4, 2021
@Arqu Arqu moved this from In progress to Needs Review in Sprints Mar 4, 2021
Copy link
Member

@b5 b5 left a comment

Choose a reason for hiding this comment

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

one nit then LGTM

lib/config.go Outdated
@@ -55,37 +57,40 @@ func (m *ConfigMethods) GetConfig(p *GetConfigParams, res *[]byte) (err error) {
if p.Field != "" {
encode, err = cfg.Get(p.Field)
if err != nil {
return fmt.Errorf("error getting %s from config: %s", p.Field, err)
return nil, fmt.Errorf("error getting %s from config: %s", p.Field, err)
Copy link
Member

Choose a reason for hiding this comment

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

gotta wrap them errors:

Suggested change
return nil, fmt.Errorf("error getting %s from config: %s", p.Field, err)
return nil, fmt.Errorf("error getting %s from config: %w", p.Field, err)

Sprints automation moved this from Needs Review to Reviewer approved Mar 4, 2021
lib/config.go Outdated
return checkRPCError(m.inst.rpc.Call("ConfigMethods.GetConfig", p, res))
func (m *ConfigMethods) GetConfig(ctx context.Context, p *GetConfigParams) ([]byte, error) {
if m.inst.http != nil {
return nil, fmt.Errorf("config is not supported across nodes")
Copy link
Member

Choose a reason for hiding this comment

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

on second thought, this error is the one users will when they try to qri config get while running qri connect somewhere else. We should make this a standard error ErrUnsupportedRPC so we can capture it with errors.Is & present a clearer error for CLI users ("this could mean you're running qri connect in another terminal")

Sprints automation moved this from Reviewer approved to Needs Review Mar 4, 2021
@Arqu Arqu force-pushed the arqu/rth_config branch 2 times, most recently from 452e316 to 4ae9b66 Compare March 5, 2021 10:32
@Arqu Arqu requested a review from b5 March 5, 2021 11:01
lib/lib_test.go Outdated
@@ -187,7 +187,7 @@ func TestReceivers(t *testing.T) {
inst := &Instance{node: node, cfg: cfg}

reqs := Receivers(inst)
expect := 10
expect := 9
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before merging, need to rebase and drop this to 8.

Copy link
Contributor

@dustmop dustmop left a comment

Choose a reason for hiding this comment

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

LGTM. We don't need config for Desktop, is that right?

@Arqu
Copy link
Contributor Author

Arqu commented Mar 5, 2021

LGTM. We don't need config for Desktop, is that right?

AFAIK No just checked the codebase real quick, also Desktop communicates API only.

@Arqu Arqu merged commit fd1f9dd into master Mar 5, 2021
Sprints automation moved this from Needs Review to Done Mar 5, 2021
@Arqu Arqu deleted the arqu/rth_config branch March 5, 2021 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API JSON API issues RPC remote procedure call issues
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants