update import paths
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
677949c8b8
commit
184ec6b7fe
6
env.go
6
env.go
@ -1,4 +1,4 @@
|
|||||||
package env
|
package env // import "go.unistack.org/micro-config-env/v3"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@ -9,8 +9,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/imdario/mergo"
|
"github.com/imdario/mergo"
|
||||||
"github.com/unistack-org/micro/v3/config"
|
"go.unistack.org/micro/v3/config"
|
||||||
rutil "github.com/unistack-org/micro/v3/util/reflect"
|
rutil "go.unistack.org/micro/v3/util/reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
var DefaultStructTag = "env"
|
var DefaultStructTag = "env"
|
||||||
|
12
env_test.go
12
env_test.go
@ -1,12 +1,11 @@
|
|||||||
package env_test
|
package env
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
env "github.com/unistack-org/micro-config-env/v3"
|
"go.unistack.org/micro/v3/config"
|
||||||
"github.com/unistack-org/micro/v3/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
@ -21,7 +20,7 @@ type Config struct {
|
|||||||
func TestLoad(t *testing.T) {
|
func TestLoad(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
conf := &Config{StringValue: "before_load"}
|
conf := &Config{StringValue: "before_load"}
|
||||||
cfg := env.NewConfig(config.Struct(conf))
|
cfg := NewConfig(config.Struct(conf))
|
||||||
|
|
||||||
if err := cfg.Init(); err != nil {
|
if err := cfg.Init(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -67,10 +66,11 @@ func TestLoad(t *testing.T) {
|
|||||||
|
|
||||||
t.Logf("cfg %#+v", conf)
|
t.Logf("cfg %#+v", conf)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSave(t *testing.T) {
|
func TestSave(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
conf := &Config{StringValue: "MICRO_CONFIG_ENV"}
|
conf := &Config{StringValue: "MICRO_CONFIG_ENV"}
|
||||||
cfg := env.NewConfig(config.Struct(conf))
|
cfg := NewConfig(config.Struct(conf))
|
||||||
|
|
||||||
if err := cfg.Init(); err != nil {
|
if err := cfg.Init(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -102,7 +102,5 @@ func TestSave(t *testing.T) {
|
|||||||
if v, ok := os.LookupEnv("STRING_VALUE"); ok {
|
if v, ok := os.LookupEnv("STRING_VALUE"); ok {
|
||||||
t.Fatalf("env value %s=%s set", tv, v)
|
t.Fatalf("env value %s=%s set", tv, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
4
go.mod
4
go.mod
@ -1,8 +1,8 @@
|
|||||||
module github.com/unistack-org/micro-config-env/v3
|
module go.unistack.orgmicro-config-env/v3
|
||||||
|
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/imdario/mergo v0.3.12
|
github.com/imdario/mergo v0.3.12
|
||||||
github.com/unistack-org/micro/v3 v3.7.6
|
go.unistack.org/micro/v3 v3.8.5
|
||||||
)
|
)
|
||||||
|
8
go.sum
8
go.sum
@ -7,10 +7,10 @@ github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
|
|||||||
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
||||||
github.com/silas/dag v0.0.0-20210626123444-3804bac2d6d4/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
github.com/silas/dag v0.0.0-20210626123444-3804bac2d6d4/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
||||||
github.com/unistack-org/micro-proto v0.0.9 h1:KrWLS4FUX7UAWNAilQf70uad6ZPf/0EudeddCXllRVc=
|
go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA=
|
||||||
github.com/unistack-org/micro-proto v0.0.9/go.mod h1:Cckwmzd89gvS7ThxzZp9kQR/EOdksFQcsTAtDDyKwrg=
|
go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8=
|
||||||
github.com/unistack-org/micro/v3 v3.7.6 h1:cobNkaicZR+8nbDWRUmX3/CSLh6ZNSytK2zWth4s4IM=
|
go.unistack.org/micro/v3 v3.8.5 h1:DIYWRsQF+NPhKZP45sCtNsUhaRw6u2+Ps7U+pKU7i3s=
|
||||||
github.com/unistack-org/micro/v3 v3.7.6/go.mod h1:Ke/8WJlNZi4ZYwL9HcsANAbQ66/HocTBEZM+od99/mM=
|
go.unistack.org/micro/v3 v3.8.5/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA=
|
||||||
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
@ -3,9 +3,9 @@ package env
|
|||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/unistack-org/micro/v3/config"
|
"go.unistack.org/micro/v3/config"
|
||||||
"github.com/unistack-org/micro/v3/util/jitter"
|
"go.unistack.org/micro/v3/util/jitter"
|
||||||
rutil "github.com/unistack-org/micro/v3/util/reflect"
|
rutil "go.unistack.org/micro/v3/util/reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
type envWatcher struct {
|
type envWatcher struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user