mirror of
https://github.com/hanzoai/core-networkmanagement.git
synced 2026-09-30 20:56:28 +00:00
32 lines
656 B
Go
32 lines
656 B
Go
package assets
|
|
import (
|
|
"sync"
|
|
"core-networkmanager/frontend/plugins"
|
|
)
|
|
|
|
var (
|
|
mux sync.Mutex
|
|
active bool
|
|
)
|
|
|
|
//init registers the plugin as available with Plugin manager
|
|
func init() {
|
|
plugins.RegisterPlugin("assets", &plugin{})
|
|
}
|
|
|
|
//plugin struct that for the plugin to impliment required and optional interfaces as defined in Plugin package
|
|
type plugin struct {}
|
|
|
|
//Activate sets up endpoints and databases, and any other initialization
|
|
func (p plugin ) Activate () {
|
|
if(!active) {
|
|
mux.Lock()
|
|
active = setup()
|
|
mux.Unlock()
|
|
}
|
|
}
|
|
|
|
//Active returns true if the plugin has already been activated
|
|
func (p plugin ) Active () bool {
|
|
return active
|
|
} |