mirror of
https://github.com/ipfs/kubo.git
synced 2025-08-06 11:31:54 +08:00

- 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)
26 lines
600 B
Go
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
|
|
}
|
|
}
|