README

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)
Expand ▾ Collapse ▴

Documentation

Overview

Package memory is a memory source

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSource

func NewSource(opts ...source.Option) source.Source

func WithChangeSet

func WithChangeSet(cs *source.ChangeSet) source.Option

WithChangeSet allows a changeset to be set

func WithJSON

func WithJSON(d []byte) source.Option

WithJSON allows the source data to be set to json

func WithYAML

func WithYAML(d []byte) source.Option

WithYAML allows the source data to be set to yaml

Types

This section is empty.