config

package
v0.0.0-...-7aa268a Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config provides config file loading and overridding using env vars.

Index

Constants

View Source
const MaxRelationships = 10

MaxRelationships is the maximum number of types of relationships tracked. Out-of-the-box, Tomolink supports tracking of up to 10 different kinds of relationships. This can be changed and Tomolink recompiled, but note that raising this value indiscriminantly may have an impact on startup times!

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	DB            interface{}
	Cfg           *goconfig.Config
	Overrides     map[string]string
	Relationships map[string]string
}

AppConfig holds the loaded static config, env overrides, and any runtime configuration for the app (shared database connections, etc)

func (*AppConfig) Connect

func (ac *AppConfig) Connect(dbEngine string) error

Connect to the selected database and make a single client for all requests going through this API instance to share.

func (*AppConfig) Load

func (ac *AppConfig) Load(appName string) error

Load the application goconfig into a goconfig.Config object Looks for defaults in <appName>_defaults.YAML

func (*AppConfig) StrictMW

func (ac *AppConfig) StrictMW(next http.Handler) http.Handler

StrictMW is a middleware function that checkes the 'relationships.strict' config value and if true, it will refuse to permit requests to access relationships not defined in the app config

Jump to

Keyboard shortcuts

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