Skip to content

Commit

Permalink
feat: add new driver use Java properties as config source
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Aug 9, 2022
1 parent 1ca5fff commit 4ed0a18
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/BurntSushi/toml v1.2.0
github.com/gookit/goutil v0.5.7
github.com/gookit/ini/v2 v2.1.1
github.com/gookit/properties v0.0.0-20220808091034-7fbd8454e142
github.com/hashicorp/hcl v1.0.0
github.com/hashicorp/hcl/v2 v2.13.0
github.com/imdario/mergo v0.3.13
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ github.com/gookit/goutil v0.5.7 h1:WaeQ96zRB/69ho5fOcOb1J2diRAMXX5i9Pm1z5Uh2v4=
github.com/gookit/goutil v0.5.7/go.mod h1:Cmt+ahuf18EHMAlF6EoOUD/KAdYcD7FdVUbpZC+zTfc=
github.com/gookit/ini/v2 v2.1.1 h1:q2VtSSl/ivTOZMPvxhjWxO3f146NvWM84jBQZETj/1o=
github.com/gookit/ini/v2 v2.1.1/go.mod h1:zkMTCrnE2QgDW0izB/pRtgEKKjXmT/22dfk5eZg+IHo=
github.com/gookit/properties v0.0.0-20220808091034-7fbd8454e142 h1:++rGX59M6pDVifR9XTWKYkHFIGjeIJ2a7yIWpoCSwZI=
github.com/gookit/properties v0.0.0-20220808091034-7fbd8454e142/go.mod h1:5bQJ+BPO2n22tZWV4IWT6PiN2U5OJJAY/omLhz5LyK4=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgCNc=
Expand Down
26 changes: 26 additions & 0 deletions properties/properties.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Package properties is a driver use Java properties format content as config source
Usage please see readme.
*/
package properties

import (
"github.com/gookit/config/v2"
"github.com/gookit/properties"
)

// DriverName string
const DriverName = "properties"

var (
// Decoder the properties content decoder
Decoder config.Decoder = properties.Decode

// Encoder the properties content encoder
Encoder config.Encoder = properties.Encode

// Driver for yaml
Driver = config.NewDriver(DriverName, Decoder, Encoder)
)

0 comments on commit 4ed0a18

Please sign in to comment.