tools

module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: GPL-3.0

README

Tools

Env

Go library to load environment properties

Is really simple to use.

Examples
Installation

Clone in your go path

git clone https://github.com/basset-la/tools
Importing
import "github.com/basset-la/tools"
Create properties

Create a folder in your project

mkdir YOUR_PROJECT_PATH/properties

Create prop files

touch YOUR_PROJECT_PATH/properties/development.yaml

Put some props

---
app:
  appPath: /test
Create a struct to access your properties easily and define a global var
// global var
var props Properties

// Properties : Struct used to map env.yaml properties file
type Properties struct {
	App struct {
		Path string `yaml:"appPath"`
	}
}
Load your props

In your main func call to LoadProperties func telling the name of the properties folder and passing the struct to map the yaml

env.LoadProperties("properties", &props)
Running your project

When you run your project don't forget to pass the -e parameter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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