config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConfigNotSet = errors.New("call LoadConfig before this function")

Functions

func LoadConfig

func LoadConfig(path string) error

LoadConfig is used to load the configuration from either the json config file or the environment variables.

Types

type Configuration

type Configuration struct {
	MongoDsn  string     `json:"mongo_dsn"`
	RedisDsn  string     `json:"redis_dsn"`
	DbName    string     `json:"db_name"`
	Relations []Relation `json:"relations"`
	Port      uint32     `json:"port"`
}

func Get

func Get() (Configuration, error)

Get fetches the application configuration. LoadConfig must have been called previously for this to work. Use this when you need to get access to the config object at runtime

type Entity

type Entity struct {
	Id         string `json:"id,omitempty"`
	Name       string `json:"name"`
	PrimaryKey string `json:"pk,omitempty"`
	ForeignKey string `json:"fk,omitempty"`
}

type Relation

type Relation struct {
	Parent   *Entity   `json:"parent"`
	Children []*Entity `json:"children"`
	On       string    `json:"on"`
	Do       string    `json:"do"`
}

Jump to

Keyboard shortcuts

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