cmd/stepd: Load plugins from STEP_PLUGIN_PATH

This commit is contained in:
Sasha Koshka 2024-12-10 13:25:32 -05:00
parent 209270a179
commit 4c3f0056fd

View File

@ -116,6 +116,23 @@ func main () {
if err != nil { log.Fatal(err) }
// TODO: load plugins
pluginPath := os.Getenv("STEP_PLUGIN_PATH")
if pluginPath == "" {
pluginPath = "/usr/lib/step/plugins:/usr/local/lib/step/plugins"
}
for _, pat := range filepath.SplitList(pluginPath) {
entries, err := os.ReadDir(pat)
if err != nil { continue }
for _, entry := range entries {
pluginPath := filepath.Join(pat, entry.Name())
_, err := environment.LoadProviderPlugin(pat)
if err != nil {
log.Printf (
"!!! could not load plugin %s: %v",
pluginPath, err)
}
}
}
logProviders(environment.Providers)
// set up the HTTP handler