@cryptotaxi247 / kubo / commits / 2b61dbb61

main: clarify api-flag behavior

Steven Allen committed Jul 3, 2019 at 14:10 UTC 2b61dbb6128040c4e0fbe8329daf51aad064dcf9
1 file changed +5 -5
cmd/ipfs/main.go
+5 -5
@@ -223,13 +223,13 @@ func makeExecutor(req *cmds.Request, env interface{}) (cmds.Executor, error) {
223 return nil, err
224 }
225
226 - // Force the daemon when the API flag is passed (unless we're trying to
227 - // _run_ the daemon).
228 - daemonForced := apiAddr != nil && req.Command != daemonCmd
226 + // Require that the command be run on the daemon when the API flag is
227 + // passed (unless we're trying to _run_ the daemon).
228 + daemonRequested := apiAddr != nil && req.Command != daemonCmd
229
230 // Run this on the client if required.
231 if details.cannotRunOnDaemon || req.Command.External {
232 - if daemonForced {
232 + if daemonRequested {
233 // User requested that the command be run on the daemon but we can't.
234 // NOTE: We drop this check for the `ipfs daemon` command.
235 return nil, errors.New("api flag specified but command cannot be run on the daemon")
@@ -273,7 +273,7 @@ func makeExecutor(req *cmds.Request, env interface{}) (cmds.Executor, error) {
273
274 // Fallback on a local executor if we (a) have a repo and (b) aren't
275 // forcing a daemon.
276 - if !daemonForced && fsrepo.IsInitialized(cctx.ConfigRoot) {
276 + if !daemonRequested && fsrepo.IsInitialized(cctx.ConfigRoot) {
277 opts = append(opts, http.ClientWithFallback(exe))
278 }
279