code: func (p *Plugin) Init() (err error) {
  	if p.Config == nil {
  		p.Config = DefaultConfig()
  	}
  	if err := PluginConfig(p.Cfg, p.Config, p.PluginName); err != nil {
  		return err
  	}
  
  	// if there is no injected authenticator and there are credentials defined in the config file
  	// instantiate staticAuthenticator otherwise do not use basic Auth
  	if p.Authenticator == nil && len(p.Config.ClientBasicAuth) > 0 {
  		p.Authenticator, err = newStaticAuthenticator(p.Config.ClientBasicAuth)
  		if err != nil {
  			return err
  		}
  	}
  
  	p.mx = mux.NewRouter()
  	p.formatter = render.New(render.Options{
  		IndentJSON: true,
  	})
  
  	// Enable authentication if defined by config
  	if p.EnableTokenAuth {
  		p.Log.Info("Token authentication for HTTP enabled")
  		p.auth = security.NewAuthenticator(p.mx, &security.Settings{
  			Users:     p.Users,
  			ExpTime:   p.TokenExpiration,
  			Cost:      p.PasswordHashCost,
  			Signature: p.TokenSignature,
  		}, p.Log)
  	}
  
  	return err
  }
docs: // Init is the plugin entry point called by Agent Core
  // - It prepares Gorilla MUX HTTP Router