mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-02-28 11:52:06 +00:00
refactor: remove the need of the logger in the create oidc client cmd
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/steveiliop56/tinyauth/internal/utils"
|
"github.com/steveiliop56/tinyauth/internal/utils"
|
||||||
"github.com/steveiliop56/tinyauth/internal/utils/tlog"
|
|
||||||
"github.com/traefik/paerser/cli"
|
"github.com/traefik/paerser/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,10 +18,8 @@ func createOidcClientCmd() *cli.Command {
|
|||||||
Resources: nil,
|
Resources: nil,
|
||||||
AllowArg: true,
|
AllowArg: true,
|
||||||
Run: func(args []string) error {
|
Run: func(args []string) error {
|
||||||
tlog.NewSimpleLogger().Init()
|
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
tlog.App.Fatal().Msg("Client name is required. Use tinyauth oidc create <name>")
|
return errors.New("client name is required. use tinyauth oidc create <name>")
|
||||||
}
|
}
|
||||||
|
|
||||||
clientName := args[0]
|
clientName := args[0]
|
||||||
@@ -29,7 +27,7 @@ func createOidcClientCmd() *cli.Command {
|
|||||||
match, err := regexp.MatchString("^[a-zA-Z0-9-]*$", clientName)
|
match, err := regexp.MatchString("^[a-zA-Z0-9-]*$", clientName)
|
||||||
|
|
||||||
if !match || err != nil {
|
if !match || err != nil {
|
||||||
tlog.App.Fatal().Msg("Client name can only contain alphanumeric characters and hyphens")
|
return errors.New("client name can only contain alphanumeric characters and hyphens")
|
||||||
}
|
}
|
||||||
|
|
||||||
uuid := uuid.New()
|
uuid := uuid.New()
|
||||||
|
|||||||
Reference in New Issue
Block a user