mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-18 08:26:38 +02:00
f23638c036
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org> |
||
---|---|---|
.. | ||
memory.go | ||
options.go | ||
README.md | ||
watcher.go |
Memory Source
The memory source provides in-memory data as a source
Memory Format
The expected data format is json
data := []byte(`{
"hosts": {
"database": {
"address": "10.0.0.1",
"port": 3306
},
"cache": {
"address": "10.0.0.2",
"port": 6379
}
}
}`)
New Source
Specify source with data
memorySource := memory.NewSource(
memory.WithJSON(data),
)
Load Source
Load the source into config
// Create new config
conf := config.NewConfig()
// Load memory source
conf.Load(memorySource)