Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
urionz committed May 28, 2021
1 parent 80b9807 commit f3a5173
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 33 deletions.
8 changes: 5 additions & 3 deletions _examples/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package main

import (
"fmt"

"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/mvc"
"github.com/urionz/goofy"
"github.com/urionz/goofy/contracts"
"github.com/urionz/goofy/event"
"github.com/urionz/goofy/web"
"github.com/urionz/goofy/web/context"
Expand All @@ -19,8 +21,8 @@ func main() {
}),
},
}).AddServices(
func(r *web.Server) {
mvc.New(r.Application).Handle(new(Test))
func(conf contracts.Config) {
fmt.Println(conf.Strings("filesystems.disks.cos.content_detect_type"))
},
).Run()
}
Expand Down
30 changes: 0 additions & 30 deletions _examples/test.go

This file was deleted.

12 changes: 12 additions & 0 deletions config/service_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path"
"strings"

"github.com/shima-park/agollo"
"github.com/urionz/color"
Expand Down Expand Up @@ -67,6 +68,17 @@ func NewServiceProvider(app contracts.Application) error {

var loadConf = func(kv agollo.Configurations) {
for k, value := range kv {
if strings.HasSuffix(k, "]") {
fieldKeys := strings.Split(k, ".")
target := fieldKeys[len(fieldKeys)-1]
lastKeys := strings.Split(target, "[")
arrKey := lastKeys[0]
key := strings.Join(append(fieldKeys[0:len(fieldKeys)-1], arrKey), ".")
existsValue := serve.Config.Strings(key)
existsValue = append(existsValue, value.(string))
serve.Set(key, existsValue, true)
continue
}
serve.Set(k, value, true)
}
}
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ require (
github.com/urionz/config v1.1.1-0.20210301084331-76f34bf46ec3
github.com/urionz/goutil v0.4.2
github.com/urionz/ini v1.1.1-0.20210301084658-9746b6337838
github.com/zouyx/agollo/v4 v4.0.7 // indirect
go.uber.org/zap v1.16.0
golang.org/x/mod v0.4.2 // indirect
gorm.io/driver/mysql v1.0.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
github.com/zouyx/agollo v1.9.0 h1:75ZZD6Mwinry71Ds4ZpB9dOTDn3hC8cNSUlgVO5uUxU=
github.com/zouyx/agollo/v4 v4.0.6 h1:o+aFzsjzk4aO/tNMFF8LE8UQ7Swl4FDTugObWM3zDpE=
github.com/zouyx/agollo/v4 v4.0.6/go.mod h1:unhojnZiGLlT4gLpWz3Oa7sGcChZWv/1DJBkV6s8uAE=
github.com/zouyx/agollo/v4 v4.0.7 h1:aUwdnCz+1jExZbZvN1nZ+kKjn62Ula5joekZHTccj2E=
github.com/zouyx/agollo/v4 v4.0.7/go.mod h1:unhojnZiGLlT4gLpWz3Oa7sGcChZWv/1DJBkV6s8uAE=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
Expand Down

0 comments on commit f3a5173

Please sign in to comment.