config

package
v2.0.0-...-3e2c818 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() string

Default path: home directory

Types

type Config

type Config struct {
	Mongo struct {
		AtlasURI string `yaml:"uri" envconfig:"MONGO_ATLAS_URI"`
		Database string `yaml:"database" envconfig:"MONGO_DATABASE"`
	} `yaml:"mongo"`
	Api struct {
		Address string `yaml:"address" envconfig:"API_ADDRESS"`
		Prefix  string `yaml:"prefix" envconfig:"API_PREFIX"`
	} `yaml:"api"`
}

Config is the configuration of the program.

func New

func New() Config

func (*Config) ReadAll

func (cfg *Config) ReadAll(path string) error

ReadAll reads the config file and the environment variables.

func (*Config) ReadEnv

func (cfg *Config) ReadEnv() error

ReadEnv reads the environment variables.

func (*Config) ReadFile

func (cfg *Config) ReadFile(path string) error

ReadFile reads the config file.

func (*Config) WriteFile

func (cfg *Config) WriteFile(path string) error

WriteFile writes the config file.

Jump to

Keyboard shortcuts

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