fixed issues with CA now generates its own new cert
All checks were successful
release / build-and-upload (push) Successful in 16m53s
All checks were successful
release / build-and-upload (push) Successful in 16m53s
This commit is contained in:
parent
a930a697fa
commit
c1948a1439
11 changed files with 458 additions and 34 deletions
|
|
@ -101,11 +101,37 @@ func Get(name string) (App, error) {
|
|||
ctor, ok := registry[name]
|
||||
mu.RUnlock()
|
||||
if !ok {
|
||||
if owner, ch, ok := FindChannel(name); ok {
|
||||
return nil, fmt.Errorf("%q is a channel of --app %s, not an app name — use: capture --app %s --channel %s", name, owner, owner, ch)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown app %q — compiled-in apps: %v", name, Names())
|
||||
}
|
||||
return ctor()
|
||||
}
|
||||
|
||||
// FindChannel reports which registered app owns a channel id (via HasChannel).
|
||||
// Does not call Get's unknown-app path (constructs from the registry directly).
|
||||
func FindChannel(id string) (appName, channelID string, ok bool) {
|
||||
mu.RLock()
|
||||
names := make([]string, 0, len(registry))
|
||||
ctors := make([]func() (App, error), 0, len(registry))
|
||||
for n, ctor := range registry {
|
||||
names = append(names, n)
|
||||
ctors = append(ctors, ctor)
|
||||
}
|
||||
mu.RUnlock()
|
||||
for i, ctor := range ctors {
|
||||
a, err := ctor()
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if a.HasChannel(id) {
|
||||
return names[i], id, true
|
||||
}
|
||||
}
|
||||
return "", "", false
|
||||
}
|
||||
|
||||
// Names lists registered app ids, sorted.
|
||||
func Names() []string {
|
||||
mu.RLock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue