Compare commits

...

28 Commits
v3 ... master

Author SHA1 Message Date
Василий Толстов e943421543 update deps
build / test (push) Failing after 1m14s Details
codeql / analyze (go) (push) Failing after 1m49s Details
build / lint (push) Successful in 9m40s Details
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-03-06 17:30:27 +03:00
Василий Толстов 5fbf98760f fixup conditions
build / test (push) Has been cancelled Details
build / lint (push) Has been cancelled Details
codeql / analyze (go) (push) Has been cancelled Details
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-01-15 01:55:20 +03:00
Василий Толстов c62fe465bf Merge pull request 'update for latest micro changes' (#98) from microv4 into master
build / test (push) Failing after 1m28s Details
build / lint (push) Failing after 2m33s Details
codeql / analyze (go) (push) Failing after 3m9s Details
Reviewed-on: #98
2023-08-14 23:45:39 +03:00
Василий Толстов 7d22067441 update for latest micro changes
codeql / analyze (go) (pull_request) Failing after 3m7s Details
dependabot-automerge / automerge (pull_request) Has been skipped Details
prbuild / test (pull_request) Failing after 1m28s Details
prbuild / lint (pull_request) Failing after 2m42s Details
autoapprove / autoapprove (pull_request) Failing after 1m26s Details
automerge / automerge (pull_request) Failing after 3s Details
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-08-14 23:45:21 +03:00
Василий Толстов 45631ab974 Merge pull request 'move to micro v4' (#97) from v4 into master
Reviewed-on: #97
2023-05-05 17:41:12 +03:00
Василий Толстов b1badeef63 move to micro v4
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-05-05 17:40:52 +03:00
Василий Толстов 64d820f251 Merge branch 'v3' 2023-05-05 17:39:21 +03:00
Василий Толстов bef606a7ee update workflows
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 19:08:55 +03:00
Василий Толстов b39be29685
Merge pull request #52 from unistack-org/dependabot/github_actions/dependabot/fetch-metadata-1.2.1
Bump dependabot/fetch-metadata from 1.1.1 to 1.2.1
2022-02-25 09:47:17 +03:00
Василий Толстов 2b10a1e5b1
Merge pull request #53 from unistack-org/dependabot/github_actions/golangci/golangci-lint-action-3
Bump golangci/golangci-lint-action from 2 to 3
2022-02-25 09:33:54 +03:00
dependabot[bot] 2add696dc8
Bump golangci/golangci-lint-action from 2 to 3
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 2 to 3.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-25 04:21:50 +00:00
dependabot[bot] 7945c2cc71
Bump dependabot/fetch-metadata from 1.1.1 to 1.2.1
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.1.1 to 1.2.1.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.1.1...v1.2.1)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-23 04:21:12 +00:00
Василий Толстов 9ffc9b6a21
Merge pull request #50 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.21
Bump go.unistack.org/micro/v3 from 3.8.20 to 3.8.21
2022-01-31 07:24:30 +03:00
dependabot[bot] e177ee76c0
Bump go.unistack.org/micro/v3 from 3.8.20 to 3.8.21
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.20 to 3.8.21.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.20...v3.8.21)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-31 04:24:09 +00:00
Василий Толстов 2b3f80d430
Merge pull request #49 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.20
Bump go.unistack.org/micro/v3 from 3.8.19 to 3.8.20
2022-01-26 07:21:55 +03:00
dependabot[bot] 0aeaaaecd3
Bump go.unistack.org/micro/v3 from 3.8.19 to 3.8.20
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.19 to 3.8.20.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.19...v3.8.20)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-26 04:21:39 +00:00
Василий Толстов e8707bb398
Merge pull request #48 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.19
Bump go.unistack.org/micro/v3 from 3.8.18 to 3.8.19
2022-01-25 07:21:49 +03:00
dependabot[bot] e1bf956f6d
Bump go.unistack.org/micro/v3 from 3.8.18 to 3.8.19
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.18 to 3.8.19.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.18...v3.8.19)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-25 04:21:31 +00:00
Василий Толстов d39141e7a9
Merge pull request #47 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.18
Bump go.unistack.org/micro/v3 from 3.8.16 to 3.8.18
2022-01-24 07:21:48 +03:00
dependabot[bot] a4d99c6b13
Bump go.unistack.org/micro/v3 from 3.8.16 to 3.8.18
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.16 to 3.8.18.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.16...v3.8.18)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-24 04:21:34 +00:00
Василий Толстов 6127475aa5
Merge pull request #46 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.16
Bump go.unistack.org/micro/v3 from 3.8.15 to 3.8.16
2022-01-21 07:24:11 +03:00
dependabot[bot] 425034bcc7
Bump go.unistack.org/micro/v3 from 3.8.15 to 3.8.16
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.15 to 3.8.16.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.15...v3.8.16)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-21 04:23:48 +00:00
Василий Толстов ed3325aaf7
Merge pull request #45 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.15
Bump go.unistack.org/micro/v3 from 3.8.14 to 3.8.15
2022-01-20 07:21:56 +03:00
dependabot[bot] d97b510d8f
Bump go.unistack.org/micro/v3 from 3.8.14 to 3.8.15
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.14 to 3.8.15.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.14...v3.8.15)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-20 04:21:39 +00:00
Василий Толстов 456285c70d
Merge pull request #44 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.14
Bump go.unistack.org/micro/v3 from 3.8.13 to 3.8.14
2022-01-11 07:21:59 +03:00
dependabot[bot] 6af70b3805
Bump go.unistack.org/micro/v3 from 3.8.13 to 3.8.14
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.13 to 3.8.14.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.13...v3.8.14)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-11 04:21:40 +00:00
Василий Толстов 5e02b42d4e
Merge pull request #43 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.13
Bump go.unistack.org/micro/v3 from 3.8.11 to 3.8.13
2021-12-29 00:48:24 +03:00
dependabot[bot] 292fc47f40
Bump go.unistack.org/micro/v3 from 3.8.11 to 3.8.13
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.11 to 3.8.13.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.11...v3.8.13)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-28 21:48:06 +00:00
5 changed files with 35 additions and 25 deletions

27
env.go
View File

@ -1,4 +1,4 @@
package env // import "go.unistack.org/micro-config-env/v3"
package env // import "go.unistack.org/micro-config-env/v4"
import (
"context"
@ -8,9 +8,10 @@ import (
"strconv"
"strings"
"github.com/imdario/mergo"
"go.unistack.org/micro/v3/config"
rutil "go.unistack.org/micro/v3/util/reflect"
"dario.cat/mergo"
"go.unistack.org/micro/v4/config"
"go.unistack.org/micro/v4/options"
rutil "go.unistack.org/micro/v4/util/reflect"
)
var DefaultStructTag = "env"
@ -23,7 +24,7 @@ func (c *envConfig) Options() config.Options {
return c.opts
}
func (c *envConfig) Init(opts ...config.Option) error {
func (c *envConfig) Init(opts ...options.Option) error {
for _, o := range opts {
o(&c.opts)
}
@ -39,7 +40,11 @@ func (c *envConfig) Init(opts ...config.Option) error {
return nil
}
func (c *envConfig) Load(ctx context.Context, opts ...config.LoadOption) error {
func (c *envConfig) Load(ctx context.Context, opts ...options.Option) error {
if c.opts.SkipLoad != nil && c.opts.SkipLoad(ctx, c) {
return nil
}
if err := config.DefaultBeforeLoad(ctx, c); err != nil && !c.opts.AllowFail {
return err
}
@ -315,7 +320,11 @@ func fillValues(ctx context.Context, valueOf reflect.Value, structTag string) er
return nil
}
func (c *envConfig) Save(ctx context.Context, opts ...config.SaveOption) error {
func (c *envConfig) Save(ctx context.Context, opts ...options.Option) error {
if c.opts.SkipSave != nil && c.opts.SkipSave(ctx, c) {
return nil
}
options := config.NewSaveOptions(opts...)
if err := config.DefaultBeforeSave(ctx, c); err != nil && !c.opts.AllowFail {
@ -346,7 +355,7 @@ func (c *envConfig) Name() string {
return c.opts.Name
}
func (c *envConfig) Watch(ctx context.Context, opts ...config.WatchOption) (config.Watcher, error) {
func (c *envConfig) Watch(ctx context.Context, opts ...options.Option) (config.Watcher, error) {
w := &envWatcher{
opts: c.opts,
wopts: config.NewWatchOptions(opts...),
@ -360,7 +369,7 @@ func (c *envConfig) Watch(ctx context.Context, opts ...config.WatchOption) (conf
return w, nil
}
func NewConfig(opts ...config.Option) config.Config {
func NewConfig(opts ...options.Option) config.Config {
options := config.NewOptions(opts...)
if len(options.StructTag) == 0 {
options.StructTag = DefaultStructTag

View File

@ -6,8 +6,8 @@ import (
"testing"
"time"
"go.unistack.org/micro/v3/config"
rutil "go.unistack.org/micro/v3/util/reflect"
"go.unistack.org/micro/v4/config"
rutil "go.unistack.org/micro/v4/util/reflect"
)
type Config struct {

10
go.mod
View File

@ -1,8 +1,10 @@
module go.unistack.org/micro-config-env/v3
module go.unistack.org/micro-config-env/v4
go 1.18
go 1.20
require (
github.com/imdario/mergo v0.3.13
go.unistack.org/micro/v3 v3.10.16
dario.cat/mergo v1.0.0
go.unistack.org/micro/v4 v4.0.15
)
require github.com/google/uuid v1.5.0 // indirect

13
go.sum
View File

@ -1,10 +1,9 @@
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
go.unistack.org/micro/v3 v3.10.16 h1:2er/SKKYbV60M+UuJM4eYCF0MZYAIq/yNUrAbTfgq8Q=
go.unistack.org/micro/v3 v3.10.16/go.mod h1:uMAc0U/x7dmtICCrblGf0ZLgYegu3VwQAquu+OFCw1Q=
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
go.unistack.org/micro/v4 v4.0.15 h1:o4++RYX5guVPxfcJpP7VCj2Xr9BPFo6fj4+b5FStdEI=
go.unistack.org/micro/v4 v4.0.15/go.mod h1:ZDgU9931vm2l7X6RN/6UuwRIVp24GRdmQ7dKmegArk4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -3,9 +3,9 @@ package env
import (
"reflect"
"go.unistack.org/micro/v3/config"
"go.unistack.org/micro/v3/util/jitter"
rutil "go.unistack.org/micro/v3/util/reflect"
"go.unistack.org/micro/v4/config"
"go.unistack.org/micro/v4/util/jitter"
rutil "go.unistack.org/micro/v4/util/reflect"
)
type envWatcher struct {