Fix read yaml config from memory
package main import ( "fmt" "github.com/micro/go-micro/config" "github.com/micro/go-micro/config/source/memory" ) var configData = []byte(` --- a: 1234 `) func main() { memorySource := memory.NewSource( memory.WithYAML(configData), ) // Create new config conf := config.NewConfig() // Load file source conf.Load(memorySource) fmt.Println(string(conf.Bytes())) }
This commit is contained in:
parent
e613b0c205
commit
cd2ac648ff
@ -18,6 +18,7 @@ type memory struct {
|
|||||||
func (s *memory) Read() (*source.ChangeSet, error) {
|
func (s *memory) Read() (*source.ChangeSet, error) {
|
||||||
s.RLock()
|
s.RLock()
|
||||||
cs := &source.ChangeSet{
|
cs := &source.ChangeSet{
|
||||||
|
Format: s.ChangeSet.Format,
|
||||||
Timestamp: s.ChangeSet.Timestamp,
|
Timestamp: s.ChangeSet.Timestamp,
|
||||||
Data: s.ChangeSet.Data,
|
Data: s.ChangeSet.Data,
|
||||||
Checksum: s.ChangeSet.Checksum,
|
Checksum: s.ChangeSet.Checksum,
|
||||||
|
Loading…
Reference in New Issue
Block a user