chore: minor
This commit is contained in:
parent
24327e834e
commit
388a1480b0
2 changed files with 7 additions and 12 deletions
|
|
@ -6,9 +6,16 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/evcc-io/evcc/util"
|
||||
reg "github.com/evcc-io/evcc/util/registry"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
var registry = reg.New[oauth2.TokenSource]("auth")
|
||||
|
||||
func Register(typ string, fun func(map[string]any) (oauth2.TokenSource, error)) {
|
||||
registry.Add(typ, fun)
|
||||
}
|
||||
|
||||
// NewFromConfig creates auth from configuration
|
||||
func NewFromConfig(ctx context.Context, typ string, other map[string]any) (oauth2.TokenSource, error) {
|
||||
factory, err := registry.Get(strings.ToLower(typ))
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
package auth
|
||||
|
||||
import (
|
||||
reg "github.com/evcc-io/evcc/util/registry"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
var registry = reg.New[oauth2.TokenSource]("auth")
|
||||
|
||||
func Register(typ string, fun func(map[string]any) (oauth2.TokenSource, error)) {
|
||||
registry.Add(typ, fun)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue