config

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 3 Imported by: 6

README

Config - A synchronised config map

A synchronised string map for holding and passing around a common config object.

What?

A synchronised string map for holding and passing around a common config object. It was built and intended for use with auth but can be used as a standalone.

Why?

This was part of a learning exercise to create auth which is a very rough Go equivalent of dotnet core Identity services.

How?

See the tests for usage examples.

Examples

See [examples] for a http/appengine implementations which uses config and auth. This is written for appengine standard 2nd gen, but also works as a standalone.

Dependencies and services

None.

Installation

Install using go get.

$ go get -u github.com/lidstromberg/config

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is a map which contains string/string key value configuration pairs

func NewConfig

func NewConfig(ctx context.Context) *Config

NewConfig returns a new base config

func (*Config) DumpConfigMap

func (bc *Config) DumpConfigMap(ctx context.Context)

DumpConfigMap writes out the configmap

func (*Config) GetConfigValue

func (bc *Config) GetConfigValue(ctx context.Context, key string) string

GetConfigValue returns a config value from the map

func (*Config) LoadConfigMap

func (bc *Config) LoadConfigMap(ctx context.Context, valset map[string]string)

LoadConfigMap loads a map[string]string of config values

func (*Config) SetConfigValue

func (bc *Config) SetConfigValue(ctx context.Context, key, value string)

SetConfigValue sets a config value in the map

type ConfigSetting

type ConfigSetting interface {
	GetConfigValue(ctx context.Context, key string) string
	SetConfigValue(ctx context.Context, key, value string)
	LoadConfigMap(ctx context.Context, valset map[string]string)
	DumpConfigMap(ctx context.Context)
}

ConfigSetting defines operations served on a configuration map

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL