Thanks to visit codestin.com
Credit goes to github.com

Skip to content

skinnypete65/cfgreader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

This module provides reading config for you app. The module was created in the 8th homework assignment at the Tinkoff Backend Academy.

Last Version

Last version is 1.0.0

How to install

go get github.com/JustNik8/cfgreader

Usage

Declare struct, that describe your app configuration. You should use tag yaml to declare key in yaml file. For example:

type Config struct {
	Host    string        `yaml:"host"`
	Port    string        `yaml:"port"`
	Timeout time.Duration `yaml:"timeout"`
}

This struct describes the following yaml file:

host: localhost
port: 4000
timeout: 10s

Then declare variable config and call cfgreader.ReadCfg(filename, cfg).

var cfg = &Config{}
err := cfgreader.ReadCfg("./cfg.yaml", cfg)

1 param: filename string - path of yaml file

2 param: cfg any - pass pointer of config struct

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages