1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-03-23 20:32:32 +02:00
Asim Aslam d94936f6c9
v3 ()
* v3

* revert plugins

* fixup some issues
2021-01-20 13:54:31 +00:00
..
2021-01-20 13:54:31 +00:00
2021-01-20 13:54:31 +00:00
2019-09-04 15:49:58 +08:00
2021-01-20 13:54:31 +00:00

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)