mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-30 03:12:57 +08:00
refactor
This commit is contained in:
@@ -47,7 +47,7 @@ func GetProducer(url string) (core.Producer, error) {
|
||||
}
|
||||
|
||||
if handler, ok := handlers[scheme]; ok {
|
||||
parsedURL := ParseURL(url)
|
||||
parsedURL := app.ResolveSecrets(url)
|
||||
return handler(parsedURL)
|
||||
}
|
||||
}
|
||||
@@ -91,13 +91,10 @@ func GetConsumer(url string) (core.Consumer, func(), error) {
|
||||
scheme := url[:i]
|
||||
|
||||
if handler, ok := consumerHandlers[scheme]; ok {
|
||||
return handler(url)
|
||||
parsedURL := app.ResolveSecrets(url)
|
||||
return handler(parsedURL)
|
||||
}
|
||||
}
|
||||
|
||||
return nil, nil, errors.New("streams: unsupported scheme: " + url)
|
||||
}
|
||||
|
||||
func ParseURL(url string) string {
|
||||
return app.ResolveSecrets(url)
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package core
|
||||
|
||||
import "github.com/AlexxIT/go2rtc/internal/app"
|
||||
|
||||
type EventFunc func(msg any)
|
||||
|
||||
// Listener base struct for all classes with support feedback
|
||||
@@ -16,3 +18,11 @@ func (l *Listener) Fire(msg any) {
|
||||
f(msg)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *Listener) ParseSource(url string) string {
|
||||
return app.ResolveSecrets(url)
|
||||
}
|
||||
|
||||
func (l *Listener) SaveSource(path []string, value any) error {
|
||||
return app.PatchSecret(path, value)
|
||||
}
|
||||
Reference in New Issue
Block a user