schema

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: MIT Imports: 15 Imported by: 0

README

Support for mozilla/node-convict

You may wonder what config-schema.json is. We have a convention to store a JSON structure with all configuration options of our application in the repository, for this we use the format of Mozilla convict.

This subpackage parses this format.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvictToSemaKey

func ConvictToSemaKey(prefix string, path []string) (result []string)

ConvictToSemaKey translates the name to something that is appropriate for SeMa storage

Types

type CatchAllResolver

type CatchAllResolver struct{}

CatchAllResolver is a mock implementation

func (CatchAllResolver) GetClient

func (CatchAllResolver) IsVerbose

func (CatchAllResolver) IsVerbose() bool

func (CatchAllResolver) Resolve

type ConvictConfigSchema

type ConvictConfigSchema struct {
	Tree               *ConvictJSONTree
	FlatConfigurations []ConvictConfiguration
	// contains filtered or unexported fields
}

ConvictConfigSchema -

func ParseSchemaFile

func ParseSchemaFile(schemaFile string) ConvictConfigSchema

ParseSchemaFile -

type ConvictConfiguration

type ConvictConfiguration struct {
	Path         []string
	Format       convictFormat
	DefaultValue interface{} `json:"default"`
	Doc          string      `json:"doc"`
	Env          string      `json:"env"`
	Optional     bool
}

ConvictConfiguration -

func (*ConvictConfiguration) Key

func (conf *ConvictConfiguration) Key() string

Key is the standardized way of serializing a ConvictConfiguration.Path

type ConvictJSONTree

type ConvictJSONTree struct {
	Leaf     *ConvictConfiguration
	Children map[string]*ConvictJSONTree
}

ConvictJSONTree -

func (*ConvictJSONTree) Nest

func (tree *ConvictJSONTree) Nest(key string)

func (*ConvictJSONTree) UnmarshalJSON

func (tree *ConvictJSONTree) UnmarshalJSON(data []byte) error

type Matcher

Matcher -

var DefaultMatcher Matcher = func(c ConvictConfiguration, s secretmanager.KVValue, key string) bool {
	return s.GetShortName() == key
}

DefaultMatcher matches the secret with the key based on the SecretManager short-name

type SchemaResolver

type SchemaResolver interface {
	Resolve(schema ConvictConfigSchema) map[string]handlers.ResolvedSecret
	IsVerbose() bool
	GetClient() secretmanager.KVClient
}

SchemaResolver -

func MakeSchemaResolver

func MakeSchemaResolver(client secretmanager.KVClient, prefix string, verbose bool, matcher Matcher) SchemaResolver

MakeSchemaResolver -

Jump to

Keyboard shortcuts

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