Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

allow multiple API/Gateway addresses #11

Merged
merged 1 commit into from
Oct 2, 2018
Merged

Conversation

Stebalien
Copy link
Member

Alternative to #6 that doesn't require a migration. This is probably a terrible idea.

@ghost ghost assigned Stebalien Sep 15, 2018
@ghost ghost added the status/in-progress In progress label Sep 15, 2018
@ghost
Copy link

ghost commented Sep 16, 2018

I have a hunch we should really make fs-repo-migrations easier to write, with generators or templates, or something like that. Given that one of the most prominent devs is trying to avoid migrations :)

@Stebalien
Copy link
Member Author

Stebalien commented Sep 17, 2018

My primary issue with migrations is having to download them. That adds an extra update step that can easily fail.

Also, this change will probably break a ton of our test tooling (as it will break ipfs config "Addresses.API" "...").

Alternative to #6 that doesn't require a migration.
@Stebalien
Copy link
Member Author

So, @whyrusleeping at least doesn't think this is that bad and, unlike #6, this doesn't break any existing tooling (i.e., anything that runs ipfs config --json "Addresses.API" "/ip4/...").

Does this look reasonable @magik6k @lgierth @overbool?

Copy link
Member

@magik6k magik6k left a comment

Choose a reason for hiding this comment

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

1 Question to implementation, idea sgtm

func (o Strings) MarshalJSON() ([]byte, error) {
switch len(o) {
case 0:
return json.Marshal(nil)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be returning an empty array? Or will the marshaller just omit the entry if it's nil?

Choose a reason for hiding this comment

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

json.Marshal(nil) will get the value []byte("null"), so i think it makes sense.

Copy link
Member Author

Choose a reason for hiding this comment

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

Exactly. Basically, I'd like to use null for the case where no API addresses are specified.

Copy link
Member Author

Choose a reason for hiding this comment

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

@overbool want to file a PR against go-ipfs that uses this?

Choose a reason for hiding this comment

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

@Stebalien Did you mean this ipfs/kubo#5401?

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

LGTM :)

String-to-array is actually a nice coercion in some cases

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants