move p2p http proxy from api to gateway
License: MIT Signed-off-by: Ian Preston <ianopolous@protonmail.com>
Dr Ian Preston committed
Nov 10, 2018 at 21:46 UTC
78c43fe68b2c386caf70c7cb0639ac6e127b453d
1 file changed
+7
-6
cmd/ipfs/daemon.go
+7
-6
@@ -290,9 +290,9 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
290
291
// Start assembling node config
292
ncfg := &core.BuildCfg{
293
- Repo: repo,
294
- Permanent: true, // It is temporary way to signify that node is permanent
295
- Online: !offline,
293
+ Repo: repo,
294
+ Permanent: true, // It is temporary way to signify that node is permanent
295
+ Online: !offline,
296
DisableEncryptedConnections: unencrypted,
297
ExtraOpts: map[string]bool{
298
"pubsub": pubsub,
@@ -467,9 +467,6 @@ func serveHTTPApi(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, error
467
opts = append(opts, corehttp.RedirectOption("", cfg.Gateway.RootRedirect))
468
}
469
470
- if cfg.Experimental.P2pHttpProxy {
471
- opts = append(opts, corehttp.ProxyOption())
472
- }
470
node, err := cctx.ConstructNode()
471
if err != nil {
472
return nil, fmt.Errorf("serveHTTPApi: ConstructNode() failed: %s", err)
@@ -573,6 +570,10 @@ func serveHTTPGateway(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, e
570
corehttp.CommandsROOption(*cctx),
571
}
572
573
+ if cfg.Experimental.P2pHttpProxy {
574
+ opts = append(opts, corehttp.ProxyOption())
575
+ }
576
+
577
if len(cfg.Gateway.RootRedirect) > 0 {
578
opts = append(opts, corehttp.RedirectOption("", cfg.Gateway.RootRedirect))
579
}