mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
multi: let subserver manager handle disabled sub-server
Modify the sub-server Manager's AddServer method to take an `enabled` boolean so that it can handle what to do with a disabled sub-server. This will come into play in a future commit which adds a status server.
This commit is contained in:
parent
59ebfe4e93
commit
b0931f49b0
2 changed files with 16 additions and 8 deletions
|
|
@ -45,15 +45,23 @@ func NewManager(permsMgr *perms.Manager) *Manager {
|
|||
}
|
||||
|
||||
// AddServer adds a new subServer to the manager's set.
|
||||
func (s *Manager) AddServer(ss SubServer) {
|
||||
func (s *Manager) AddServer(ss SubServer, enable bool) {
|
||||
// If the sub-server has explicitly been disabled, then we don't add it
|
||||
// to the set of servers tracked by the Manager.
|
||||
if !enable {
|
||||
return
|
||||
}
|
||||
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
// Add the enabled server to the set of servers tracked by the Manager.
|
||||
s.servers = append(s.servers, &subServerWrapper{
|
||||
SubServer: ss,
|
||||
quit: make(chan struct{}),
|
||||
})
|
||||
|
||||
// Register the sub-server's permissions with the permission manager.
|
||||
s.permsMgr.RegisterSubServer(
|
||||
ss.Name(), ss.Permissions(), ss.WhiteListedURLs(),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue