1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 11:31:54 +08:00
Files
kubo/core/corehttp/commands.go
Ho-Sheng Hsiao bf22aeec0a Reorged imports from jbenet/go-ipfs to ipfs/go-ipfs
- Modified Godeps/Godeps.json by hand
- [TEST] Updated welcome docs hash to sharness
- [TEST] Updated contact doc
- [TEST] disabled breaking test (t0080-repo refs local)
2015-03-31 12:52:25 -07:00

26 lines
600 B
Go

package corehttp
import (
"net/http"
"os"
commands "github.com/ipfs/go-ipfs/commands"
cmdsHttp "github.com/ipfs/go-ipfs/commands/http"
core "github.com/ipfs/go-ipfs/core"
corecommands "github.com/ipfs/go-ipfs/core/commands"
)
const (
// TODO rename
originEnvKey = "API_ORIGIN"
)
func CommandsOption(cctx commands.Context) ServeOption {
return func(n *core.IpfsNode, mux *http.ServeMux) (*http.ServeMux, error) {
origin := os.Getenv(originEnvKey)
cmdHandler := cmdsHttp.NewHandler(cctx, corecommands.Root, origin)
mux.Handle(cmdsHttp.ApiPath+"/", cmdHandler)
return mux, nil
}
}