Skip to content

Commit

Permalink
add feature: support config map source, (#73)
Browse files Browse the repository at this point in the history
* add feature: support config map source, read kv in recurse directory

* fix golint check

* refactor code

* fix code check

* refactor code, delete duplicate file
  • Loading branch information
luckyyuyong authored and tianxiaoliang committed Jun 10, 2019
1 parent 77d6ddb commit b45d50f
Show file tree
Hide file tree
Showing 6 changed files with 951 additions and 15 deletions.
10 changes: 5 additions & 5 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package archaius

import (
"crypto/tls"
"github.com/go-chassis/go-archaius/sources/utils"

"github.com/go-chassis/go-archaius/sources/file-source"
"github.com/go-chassis/go-chassis-config"
)

Expand Down Expand Up @@ -42,7 +42,7 @@ type ConfigCenterInfo struct {
type Options struct {
RequiredFiles []string
OptionalFiles []string
FileHandler filesource.FileHandler
FileHandler utils.FileHandler
ConfigCenterInfo ConfigCenterInfo
ConfigClient config.Client
UseCLISource bool
Expand All @@ -69,7 +69,7 @@ func WithOptionalFiles(f []string) Option {

//WithDefaultFileHandler let user custom handler
//you can decide how to convert file into kv pairs
func WithDefaultFileHandler(handler filesource.FileHandler) Option {
func WithDefaultFileHandler(handler utils.FileHandler) Option {
return func(options *Options) {
options.FileHandler = handler
}
Expand Down Expand Up @@ -111,14 +111,14 @@ func WithMemorySource() Option {

//FileOptions for AddFile func
type FileOptions struct {
Handler filesource.FileHandler
Handler utils.FileHandler
}

//FileOption is a func
type FileOption func(options *FileOptions)

//WithFileHandler use custom handler
func WithFileHandler(h filesource.FileHandler) FileOption {
func WithFileHandler(h utils.FileHandler) FileOption {
return func(options *FileOptions) {
options.Handler = h
}
Expand Down
Loading

0 comments on commit b45d50f

Please sign in to comment.