Skip to content

Commit

Permalink
refactor all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
asim committed Dec 29, 2020
1 parent d197438 commit a7c31a0
Show file tree
Hide file tree
Showing 195 changed files with 13,897 additions and 3,390 deletions.
3 changes: 1 addition & 2 deletions api/handler/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import (
"github.com/micro/go-micro/v2/api/router"
regRouter "github.com/micro/go-micro/v2/api/router/registry"
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v2/registry/memory"
)

func testHttp(t *testing.T, path, service, ns string) {
r := memory.NewRegistry()
r := registry.NewMemoryRegistry()

l, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions api/handler/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package handler
import (
"github.com/micro/go-micro/v2/api/router"
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/client/grpc"
)

var (
Expand All @@ -27,7 +26,7 @@ func NewOptions(opts ...Option) Options {
}

if options.Client == nil {
WithClient(grpc.NewClient())(&options)
WithClient(client.NewClient())(&options)
}

// set namespace if blank
Expand Down
245 changes: 0 additions & 245 deletions api/router/router_test.go

This file was deleted.

25 changes: 0 additions & 25 deletions auth/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@ package auth
import (
"context"
"time"

"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/store"
)

func NewOptions(opts ...Option) Options {
var options Options
for _, o := range opts {
o(&options)
}
if options.Client == nil {
options.Client = client.DefaultClient
}

return options
}

Expand All @@ -33,10 +26,6 @@ type Options struct {
PublicKey string
// PrivateKey for encoding JWTs
PrivateKey string
// Store to back auth
Store store.Store
// Client to use for RPC
Client client.Client
// Addrs sets the addresses of auth
Addrs []string
}
Expand All @@ -57,13 +46,6 @@ func Namespace(n string) Option {
}
}

// Store to back auth
func Store(s store.Store) Option {
return func(o *Options) {
o.Store = s
}
}

// PublicKey is the JWT public key
func PublicKey(key string) Option {
return func(o *Options) {
Expand Down Expand Up @@ -93,13 +75,6 @@ func ClientToken(token *Token) Option {
}
}

// WithClient sets the client to use when making requests
func WithClient(c client.Client) Option {
return func(o *Options) {
o.Client = c
}
}

type GenerateOptions struct {
// Metadata associated with the account
Metadata map[string]string
Expand Down
Loading

0 comments on commit a7c31a0

Please sign in to comment.