You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,19 @@
1
-
# Go Config[](https://github.com/xgfone/gconf/actions/workflows/go.yml)[](https://pkg.go.dev/github.com/xgfone/gconf/v6)[](https://raw.githubusercontent.com/xgfone/gconf/master/LICENSE)
1
+
# Go Config
2
2
3
-
An extensible and powerful go configuration manager supporting `Go1.21+`, which is inspired by [oslo.config](https://github.com/openstack/oslo.config), [viper](https://github.com/spf13/viper) and [github.com/micro/go-micro/config](https://github.com/micro/go-micro/tree/master/config).
An extensible and powerful go configuration manager, which is inspired by [oslo.config](https://github.com/openstack/oslo.config), [viper](https://github.com/spf13/viper) and [github.com/micro/go-micro/config](https://github.com/micro/go-micro/tree/master/config).
5
10
6
11
## Install
12
+
7
13
```shell
8
14
$ go get -u github.com/xgfone/gconf/v6
9
15
```
10
16
11
-
12
17
## Features
13
18
14
19
- A atomic key-value configuration center.
@@ -17,7 +22,6 @@ $ go get -u github.com/xgfone/gconf/v6
17
22
- Support to change of the configuration option thread-safely during running.
18
23
- Support to observe the change of the configration options.
19
24
20
-
21
25
## Basic
22
26
23
27
```go
@@ -93,7 +97,6 @@ func main() {
93
97
}
94
98
```
95
99
96
-
97
100
## Option Proxy
98
101
99
102
```go
@@ -127,7 +130,6 @@ func main() {
127
130
}
128
131
```
129
132
130
-
131
133
## Option Group
132
134
133
135
```go
@@ -221,14 +223,14 @@ func main() {
221
223
}
222
224
```
223
225
224
-
225
226
## Data Decoder
227
+
226
228
The data decoder is a function like `func(src []byte, dst map[string]interface{}) error`, which is used to decode the configration data from the data source.
227
229
228
230
`Config` supports three kinds of decoders by default, such as `ini`, `json`, `yaml`, and `yml` is the alias of `yaml`. You can customize yourself decoder, then add it into `Config`, such as `Config.AddDecoder("type", NewCustomizedDecoder())`.
229
231
230
-
231
232
## Data Source
233
+
232
234
A source is used to read the configuration from somewhere the data is. And it can also watch the change the data.
0 commit comments