mirror of
https://github.com/ipfs/kubo.git
synced 2025-08-06 11:31:54 +08:00
feat: cmd/ipfs: Nicer to use BuildEnv
This commit is contained in:

committed by
Adin Schmahmann

parent
b5dddf67a2
commit
a8a12789f2
@ -110,10 +110,11 @@ func newUUID(key string) logging.Metadata {
|
||||
}
|
||||
|
||||
func BuildDefaultEnv(ctx context.Context, req *cmds.Request) (cmds.Environment, error) {
|
||||
return BuildEnv(ctx, req, nil)
|
||||
return BuildEnv(nil)(ctx, req)
|
||||
}
|
||||
|
||||
func BuildEnv(ctx context.Context, req *cmds.Request, pl PluginPreloader) (cmds.Environment, error) {
|
||||
func BuildEnv(pl PluginPreloader) func(ctx context.Context, req *cmds.Request) (cmds.Environment, error) {
|
||||
return func(ctx context.Context, req *cmds.Request) (cmds.Environment, error) {
|
||||
checkDebug(req)
|
||||
repoPath, err := GetRepoPath(req)
|
||||
if err != nil {
|
||||
@ -155,6 +156,7 @@ func BuildEnv(ctx context.Context, req *cmds.Request, pl PluginPreloader) (cmds.
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func Start(buildEnv func(ctx context.Context, req *cmds.Request) (cmds.Environment, error)) (exitCode int) {
|
||||
ctx := logging.ContextWithLoggable(context.Background(), newUUID("session"))
|
||||
|
Reference in New Issue
Block a user