add before Init func support

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-03-16 07:25:01 +03:00
parent a10e29b8d5
commit 1603add6e6
4 changed files with 27 additions and 4 deletions

23
vault_test.go Normal file
View File

@@ -0,0 +1,23 @@
package vault
import (
"context"
"testing"
"go.unistack.org/micro/v3/codec"
"go.unistack.org/micro/v3/config"
)
func TestInit(t *testing.T) {
c := NewConfig(
config.Context(context.TODO()),
config.Codec(codec.NewCodec()),
config.BeforeInit(func(ctx context.Context, c config.Config) error {
return c.Init(Token("tkn"), config.BeforeInit(nil))
}),
)
if err := c.Init(); err != nil {
t.Fatal(err)
}
}