From 1d01c0354ff55de20b9f1d06bfbdead4a1bbd332 Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Wed, 4 Feb 2015 18:50:59 -0800 Subject: [PATCH] refactor(cmd/daemon) more compact representation! exposed the Decider to make configuration nicer @mappum --- cmd/ipfs/daemon.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index 07e34bbb0..2dcf48e4d 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -193,19 +193,19 @@ func daemonFunc(req cmds.Request, res cmds.Response) { }() } - blocklist := &corehttp.BlockList{} - blocklist.SetDecider(func(s string) bool { - // for now, only allow paths in the WebUI path - for _, webuipath := range corehttp.WebUIPaths { - if strings.HasPrefix(s, webuipath) { - return true - } - } - return false - }) gateway := corehttp.NewGateway(corehttp.GatewayConfig{ - Writable: true, - BlockList: blocklist, + Writable: true, + BlockList: &corehttp.BlockList{ + Decider: func(s string) bool { + // for now, only allow paths in the WebUI path + for _, webuipath := range corehttp.WebUIPaths { + if strings.HasPrefix(s, webuipath) { + return true + } + } + return false + }, + }, }) var opts = []corehttp.ServeOption{ corehttp.CommandsOption(*req.Context()),