Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 479 Bytes

README.md

File metadata and controls

31 lines (21 loc) · 479 Bytes

goenvconfig

Inspired by Elixir env configs (prod, test, dev) and Ruby .env

Usage

  • include .env , .env.test and .env.development in your project root folder
package main

import (
    "os"

    "github.com/grandeto/goenvconfig"
)

func init() {
    goenvconfig.LoadConfig()
}

func main() {
    dbDsn := os.Getenv("DB_DSN")
}
  • build your go app by including in -tags prod, test or dev depending on your environment
go build -tags prod .