kubo/test/sharness/t0280-plugin-data/example.go
Steven Allen 150b6dd1bd plugins: add support for plugin configs
For now, configs specified in `daemon --init-config` and `init CONFIG` are not
available. We should fix this eventually but isn't necessary for now (and
supporting this will be annoying).
2019-08-29 17:17:23 -07:00

31 lines
471 B
Go

package main
import (
"fmt"
"os"
"github.com/ipfs/go-ipfs/plugin"
)
var Plugins = []plugin.Plugin{
&testPlugin{},
}
var _ = Plugins // used
type testPlugin struct{}
func (*testPlugin) Name() string {
return "test-plugin"
}
func (*testPlugin) Version() string {
return "0.1.0"
}
func (*testPlugin) Init(env *plugin.Environment) error {
fmt.Fprintf(os.Stderr, "testplugin %s\n", env.Repo)
fmt.Fprintf(os.Stderr, "testplugin %v\n", env.Config)
return nil
}