refactor(cmd/daemon) more compact representation!
exposed the Decider to make configuration nicer @mappum
Brian Tiger Chow committed
Feb 4, 2015 at 18:50 UTC
1d01c0354ff55de20b9f1d06bfbdead4a1bbd332
1 file changed
+12
-12
cmd/ipfs/daemon.go
+12
-12
@@ -193,19 +193,19 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
193
}()
194
}
195
196
- blocklist := &corehttp.BlockList{}
197
- blocklist.SetDecider(func(s string) bool {
198
- // for now, only allow paths in the WebUI path
199
- for _, webuipath := range corehttp.WebUIPaths {
200
- if strings.HasPrefix(s, webuipath) {
201
- return true
202
- }
203
- }
204
- return false
205
- })
196
gateway := corehttp.NewGateway(corehttp.GatewayConfig{
207
- Writable: true,
208
- BlockList: blocklist,
197
+ Writable: true,
198
+ BlockList: &corehttp.BlockList{
199
+ Decider: func(s string) bool {
200
+ // for now, only allow paths in the WebUI path
201
+ for _, webuipath := range corehttp.WebUIPaths {
202
+ if strings.HasPrefix(s, webuipath) {
203
+ return true
204
+ }
205
+ }
206
+ return false
207
+ },
208
+ },
209
})
210
var opts = []corehttp.ServeOption{
211
corehttp.CommandsOption(*req.Context()),