goconfigenv

Load Config Struct from environment variables (using struct tags).

Installation

go get github.com/iamganeshagrawal/goconfigenv

Example


package main

import (
	"fmt"

	"github.com/iamganeshagrawal/goconfigenv"
)

type Config struct {
	Port   int    `configenv:"PORT"`
	Secret string `configenv:"JWT_SECRET"`
	HTTPS  bool   `configenv:"HTTPS"`
}

func main() {
	var config Config
	goconfigenv.Load(&config)
	fmt.Println(config)
}