zoie 88e39c560e update: 修改module 1 gadu atpakaļ
..
README.md 0d50f1d40f 2023-07-03 1 gadu atpakaļ
memory.go 88e39c560e update: 修改module 1 gadu atpakaļ
options.go 88e39c560e update: 修改module 1 gadu atpakaļ
watcher.go 88e39c560e update: 修改module 1 gadu atpakaļ

README.md

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)