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

feat: allow custom ipfs binary #1427

Merged
merged 3 commits into from
Apr 27, 2020
Merged

feat: allow custom ipfs binary #1427

merged 3 commits into from
Apr 27, 2020

Conversation

hacdias
Copy link
Member

@hacdias hacdias commented Apr 18, 2020

This closes #836. With this PR, the user is now able to set their own custom IPFS binary. The option to do so is under Advanced as it is an advanced feature:

image

If a custom IPFS binary is set, then the 'Set Custom IPFS Binary' is replaced by 'Clear Custom IPFS Binary'.

The IPFS on PATH now obbeys to this so the ipfs binary available for the user is the one that IPFS Desktop is using, no matter if it's provided by IPFS_GO_EXEC, set by the user, or the default that is bundled with IPFS Desktop.

Setting the environment variable IPFS_GO_EXEC affects the IPFS binary used while it is set. If IPFS Desktop is restarted and that variable is no longer set, we default to either the custom user defined binary or to the bundled binary.

License: MIT
Signed-off-by: Henrique Dias [email protected]

@hacdias hacdias added the status/blocked Unable to be worked further until needs are met label Apr 18, 2020
@hacdias hacdias requested a review from lidel April 18, 2020 19:14
@hacdias hacdias mentioned this pull request Apr 18, 2020
22 tasks
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

(not a review, just quick feedback)

For the context, there are two things user may want to override:

This PR is a good opportunity to unify / double check those behaviors.

  • menu items should be next to each other, perhaps separated from the rest with a line?
  • expectation of persistence:
    • changes made via GUI should persist across restarts
    • changes made via CLI disappear when env variable is no longer set during next run
  • this really needs tests

@hacdias hacdias force-pushed the feat/custom-binary branch 3 times, most recently from a01ef4c to 13dda65 Compare April 22, 2020 08:06
@hacdias
Copy link
Member Author

hacdias commented Apr 22, 2020

This PR is a good opportunity to unify / double check those behaviors.

I wanted to add an information here about what we are doing about the IPFS_PATH environment variable: we are not setting a global IPFS_PATH variable. We're just overriding it when using the "IPFS on PATH" feature.

Our binary wrapper on Windows:

https://github.com/ipfs-shipyard/ipfs-desktop/blob/b9d6f188ae737e0c388656050b5d6568081c4507/src/ipfs-on-path/scripts/bin-win/ipfs.cmd#L1-L7

Our binary wrapper on other OSes:

https://github.com/ipfs-shipyard/ipfs-desktop/blob/b9d6f188ae737e0c388656050b5d6568081c4507/src/ipfs-on-path/scripts/ipfs.sh#L1-L14

menu items should be next to each other, perhaps separated from the rest with a line?

Just done.

changes made via GUI should persist across restarts

Already done.

changes made via CLI disappear when env variable is no longer set during next run

We're not setting global env vars.

this really needs tests

It does. And they're complicated. Windows, macOS and Linux.

@hacdias
Copy link
Member Author

hacdias commented Apr 22, 2020

I think I interpreted you wrong @lidel! The env vars should affect IPFS Desktop. And not the opposite. About IPFS_PATH then: the variable defines a repository and then we store on the config the repository of ipfsd.path. So, if IPFS_PATH was chosen initially to be the repository on the first run, that'll be what we save on the config.

@hacdias hacdias force-pushed the feat/custom-binary branch from 13dda65 to 926f876 Compare April 23, 2020 07:18
@hacdias hacdias removed the status/blocked Unable to be worked further until needs are met label Apr 23, 2020
@hacdias hacdias marked this pull request as ready for review April 23, 2020 11:02
@hacdias hacdias force-pushed the feat/custom-binary branch from 651bfd9 to 1286ce1 Compare April 23, 2020 11:08
@hacdias hacdias requested a review from lidel April 23, 2020 11:08
@hacdias
Copy link
Member Author

hacdias commented Apr 23, 2020

@lidel tested and works on macOS and Windows. I'd like to hear some suggestions on how to automatically test this since Spectron does not allow us to test menus.

@hacdias hacdias force-pushed the feat/custom-binary branch 2 times, most recently from 609926a to d148def Compare April 23, 2020 13:07
Copy link
Contributor

@jessicaschilling jessicaschilling left a comment

Choose a reason for hiding this comment

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

I'll keep quiet on the code itself but the interface LGTM 😊

@hacdias hacdias force-pushed the feat/custom-binary branch from d148def to e91ec0a Compare April 24, 2020 07:06
License: MIT
Signed-off-by: Henrique Dias <[email protected]>
@lidel lidel force-pushed the feat/custom-binary branch from e91ec0a to 3d15bc7 Compare April 27, 2020 11:19
hacdias and others added 2 commits April 27, 2020 12:30
License: MIT
Signed-off-by: Henrique Dias <[email protected]>
License: MIT
Signed-off-by: Marcin Rataj <[email protected]>
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

LGTM: tested on Linux, works as expected.
Ok to merge as soon CI passes and is green.

@hacdias hacdias merged commit 9d25b85 into master Apr 27, 2020
@hacdias hacdias deleted the feat/custom-binary branch April 27, 2020 12:14
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.

Maybe provide a way to configure which binary to use?
3 participants