dotnev

package
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 1 Imported by: 0

README

Dotenv

Package dotenv that supports importing data from files (eg .env) to ENV

Deprecated: please use package https://github.com/gookit/ini/v2/dotenv

Install

go get github.com/gookit/ini/v2/dotenv
Usage
package main

import (
	"fmt"

	"github.com/gookit/ini/v2/dotenv"
)

func main() {
	err := dotenv.Load("./", ".env")
	if err != nil {
        fmt.Println(err)
	}
}
Read Env
val := dotenv.Get("ENV_KEY")
// Or use 
// val := os.Getenv("ENV_KEY")

// get int value
intVal := dotenv.Int("LOG_LEVEL")

// get bool value
blVal := dotenv.Bool("OPEN_DEBUG")

// with default value
val := dotenv.Get("ENV_KEY", "default value")

Documentation

Overview

Package dotnev provide load .env data to os ENV

Deprecated: please use github.com/gookit/ini/v2/dotenv

Index

Constants

This section is empty.

Variables

View Source
var (
	Load        = dotenv.Load
	LoadExists  = dotenv.LoadExists
	LoadFromMap = dotenv.LoadFromMap

	LoadedData      = dotenv.LoadedData
	ClearLoaded     = dotenv.ClearLoaded
	DontUpperEnvKey = dotenv.DontUpperEnvKey
)

Load and parse .env file data to os ENV.

Usage:

dotenv.Load("./", ".env")

Deprecated: please use github.com/gookit/ini/v2/dotenv

View Source
var (
	Get  = dotenv.Get
	Bool = dotenv.Bool
	Int  = dotenv.Int
)

Get ENV value by key

Deprecated: please use github.com/gookit/ini/v2/dotenv

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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