configs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Central package for app-global config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	Mappings []*DatastoreAPIMapping `yaml:"apis"`
}

Configuration for the API-mappings used by kelon to map incoming requests to rego packages.

type APIMapping

type APIMapping struct {
	Path    string
	Package string
	Methods []string
	Queries []string
}

Mapping within a configs.DatastoreAPIMapping which holds all information that is needed to map an incoming request to a rego package. The Path can be a regular expression.

type AppConfig

type AppConfig struct {
	ExternalConfig
	TelemetryProvider telemetry.Provider
}

Configuration for the entire app.

type ByteConfigLoader

type ByteConfigLoader struct {
	DatastoreConfigBytes []byte
	APIConfigBytes       []byte
}

ByteConfigLoader implements configs.ConfigLoader by loading config from two provided bytes slices.

func (ByteConfigLoader) Load

func (l ByteConfigLoader) Load() (*ExternalConfig, error)

Implementing Load from configs.ConfigLoader by using the properties of the ByteConfigLoader.

type ConfigLoader

type ConfigLoader interface {
	Load() (*ExternalConfig, error)
}

ConfigLoader is the interface that the functionality of loading kelon's external configuration.

Load loads all external configuration files from a predefined source. It returns the loaded configuration and any error encountered that caused the Loader to stop early.

type Datastore

type Datastore struct {
	Type       string
	Connection map[string]string
	Metadata   map[string]string
}

Each datastore has a fixed Type (enum type) and variable connection-/metadata-properties Which should be validated and parsed by each data.Datastore separately.

type DatastoreAPIMapping

type DatastoreAPIMapping struct {
	Prefix    string `yaml:"path-prefix"`
	Datastore string
	Mappings  []*APIMapping
}

API-mapping for one of the datastores defined in configs.DatastoreConfig.

Each mapping has a type of 'mapping global' Prefix which should be appended to each Path of its Mappings. The prefix can be a regular expression.

type DatastoreConfig

type DatastoreConfig struct {
	Datastores       map[string]*Datastore
	DatastoreSchemas map[string]map[string]*EntitySchema `yaml:"entity_schemas"`
}

Configuration for the Datastore-mappings used by kelon to map incoming requests to datastores.

This mapping is needed to set schemas for entities (coming from compiled regos) as well as using the datastore's alias as unknowns for OPA's partial evaluation api. The DatastoreSchema maps the datastore alias to a datastore schema to a slice of Entities which are contained in this schema.

type Entity

type Entity struct {
	Name     string
	Alias    string
	Entities []*Entity
}

Entity inside a schema

type EntitySchema

type EntitySchema struct {
	Entities []*Entity
}

List of entities of a schema

func (EntitySchema) ContainsEntity

func (schema EntitySchema) ContainsEntity(search string) (bool, *Entity)

Check if a entity is contained inside a schema. The entity is searched by its alias which is either its name, or a specified alias!

Returns a boolean indicating if the entity was found and the entity itself.

func (EntitySchema) GenerateEntityPaths

func (schema EntitySchema) GenerateEntityPaths() map[string]map[string][]string

Returns search structure for fast finding of paths from a source to a destination returned map of maps has the semantic pathBegin -> pathEnd -> path

func (EntitySchema) HasNestedEntities

func (schema EntitySchema) HasNestedEntities() bool

Returns true if the schema contains entities with nested entities

type ExternalConfig

type ExternalConfig struct {
	Data *DatastoreConfig
	API  *APIConfig
}

External config.

type FileConfigLoader

type FileConfigLoader struct {
	DatastoreConfigPath string
	APIConfigPath       string
}

FileConfigLoader implements configs.ConfigLoader by loading config from two files located at given paths.

func (FileConfigLoader) Load

func (l FileConfigLoader) Load() (*ExternalConfig, error)

Implementing Load from configs.ConfigLoader by using the properties of the FileConfigLoader.

Jump to

Keyboard shortcuts

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