envReader

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: MIT Imports: 3 Imported by: 0

README

EnvReader

A lightweight .env file reader for Go, designed to load environment variables from a file into your application seamlessly.

Features

  • Reads .env files and loads key-value pairs as environment variables.

Installation

Run the following command in your project folder to install:

go get github.com/udan-jayanith/envReader

Documentation

Overview

.env file reader for go.

`envReader "github.com/udan-jayanith/envReader"`

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get added in v1.1.0

func Get(key string) string

Get returns the value for a given key.

If the .env file hasn't been read yet, Get will read the .env file and then return the value for the given key.

func GetEnvMap added in v1.2.1

func GetEnvMap() map[string]string

GetEnvMap returns a map of the .env file.

func LoadEnv

func LoadEnv()

LoadEnv reads the .env file and stores it in the Env struct.

func SetEnvVars added in v1.2.1

func SetEnvVars()

SetEnvVars sets environment variables using os.Setenv() for each key-value pair in EnvStruct.

This allows the environment variables to be retrieved using os.Getenv().

Types

type Env

type Env struct {
	// contains filtered or unexported fields
}
var EnvFile Env

Jump to

Keyboard shortcuts

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