-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Offline daemon mode #2696
Offline daemon mode #2696
Changes from all commits
74b7fd2
a77fa94
7614f4f
bdea10f
e293204
e76a537
a5a9a9d
3a89cbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,7 +159,12 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request | |
} | ||
|
||
nd, err := core.Resolve(ctx, i.node, path.Path(urlPath)) | ||
if err != nil { | ||
// If node is in offline mode the error code and message should be different | ||
if err == core.ErrNoNamesys && !i.node.OnlineMode() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think there's other errors here to check alongside |
||
w.WriteHeader(http.StatusServiceUnavailable) | ||
fmt.Fprint(w, "Could not resolve path. Node is in offline mode.") | ||
return | ||
} else if err != nil { | ||
webError(w, "Path Resolve error", err, http.StatusBadRequest) | ||
return | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,12 +194,13 @@ test_set_address_vars() { | |
GWAY_PORT=$(port_from_maddr $GWAY_MADDR) | ||
' | ||
|
||
|
||
test_expect_success "set swarm address vars" ' | ||
if ipfs swarm addrs local >/dev/null 2>&1; then | ||
test_expect_success "set swarm address vars" ' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation problem here, i'd say indent the whole block. |
||
ipfs swarm addrs local > addrs_out && | ||
SWARM_MADDR=$(grep "127.0.0.1" addrs_out) && | ||
SWARM_PORT=$(port_from_maddr $SWARM_MADDR) | ||
' | ||
SWARM_MADDR=$(grep "127.0.0.1" addrs_out) && | ||
SWARM_PORT=$(port_from_maddr $SWARM_MADDR) | ||
' | ||
fi | ||
} | ||
|
||
test_launch_ipfs_daemon() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,4 +379,11 @@ test_expect_success "ipfs cat file fails" ' | |
|
||
test_add_named_pipe "" | ||
|
||
# Test daemon in offline mode | ||
test_launch_ipfs_daemon --offline | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great. i think we want to test |
||
|
||
test_add_cat_file | ||
|
||
test_kill_ipfs_daemon | ||
|
||
test_done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
provide the local API, maybe?