1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 05:52:20 +08:00

refactor(cmd/daemon) more compact representation!

exposed the Decider to make configuration nicer @mappum
This commit is contained in:
Brian Tiger Chow
2015-02-04 18:50:59 -08:00
parent db644fe1b7
commit 1d01c0354f

View File

@ -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()),