config

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package config can be used to load data to a struct which is defined by the "env" tag.

Data may come from a file and/or the os environment

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFromEnvironment

func LoadFromEnvironment(target any) error

LoadFromEnvironment loads environment data into the target struct.

target must be a pointer, otherwise it will return an error.

func LoadFromFile

func LoadFromFile(filename string, target any, format Format) error

LoadFromFile loads config from a file with the given format parser.

  • filename: Path + filename of the config file
  • target: target struct to load the config to (MUST be a pointer to a struct)
  • format: format type (YAML or JSON)

Types

type Format

type Format int

Format defines the currently possible config file format (YAML or JSON)

const (
	YAML Format = iota
	JSON
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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