Skip to content

goapt/dotenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golang dotenv

Build Status

Usage

Add your application configuration to your .env file in the root of your project:

S3_BUCKET=YOURS3BUCKET
SECRET_KEY=YOURSECRETKEYGOESHERE

Then in your Go app you can do something like

package main

import (
    "log"
    "os"

    "github.com/goapt/dotenv"
)

func main() {
  err := dotenv.Load()
  if err != nil {
    log.Fatal("Error loading .env file")
  }

  s3Bucket := os.Getenv("S3_BUCKET")
  secretKey := os.Getenv("SECRET_KEY")

  // now do something with s3 or whatever
}

Thanks

https://github.com/joho/godotenv

About

golang get Env in dotfile

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages