File system installer for Plugin Registry
MIT License
A file system installer for plugin-registry
Go >= 1.16
go get github.com/nhatthm/plugin-registry-fs
Import the library while bootstrapping the application (see the examples)
This installer supports installing:
.tar.gz
, .gz.
or zip
)The source must be in this format:
./my-project/
├── .plugin.registry.yaml
└── my-plugin/
└── (plugin files)
For example, if source is an archive, it should be:
./my-project/
├── .plugin.registry.yaml
└── my-plugin-1.0.0-darwin-amd64.tar.gz
package mypackage
import (
"context"
registry "github.com/nhatthm/plugin-registry"
_ "github.com/nhatthm/plugin-registry-fs" // Add file system installer.
)
var defaultRegistry = mustCreateRegistry()
func mustCreateRegistry() registry.Registry {
r, err := createRegistry()
if err != nil {
panic(err)
}
return r
}
func createRegistry() (registry.Registry, error) {
return registry.NewRegistry("~/plugins")
}
func installPlugin(source string) error {
return defaultRegistry.Install(context.Background(), source)
}
If this project help you reduce time to develop, you can give me a cup of coffee :)
or scan this