env

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package env provides functionality for getting information and data from the environment.

Index

Constants

View Source
const (
	// KeyConfigName is the environment variable key for specifying a different
	// configuration file name instead of the default.
	KeyConfigName = "CONFIG_NAME"
	// KeyPwd is the environment variable key for a stubbed working directory
	// used by tests.
	KeyPwd = "PWD"
)

Variables

This section is empty.

Functions

func AbsPath

func AbsPath(path string) (string, error)

AbsPath returns the absolute path for the given path.

Works like filepath.Abs except that it will expand the home directory if the path starts with "~".

If the path is already absolute, it will be returned as-is.

func Getenv

func Getenv(key string) string

Getenv retrieves the value of the environment variable named by the key.

Works like os.Getenv except that it will prefix the key with an application specific prefix to avoid conflicts with other environment variables.

func Getwd

func Getwd() (string, error)

Getwd returns the current working directory.

Works like os.Getwd except that it will check the environment variable for stubbing the working directory used by tests, and return the value if it's defined. This is intended for testing purposes, and should not be used as a feature.

func LookupEnv

func LookupEnv(key string) (string, bool)

LookupEnv retrieves the value of the environment variable named by the key.

Works like os.LookupEnv except that it will prefix the key with an application specific prefix to avoid conflicts with other environment.

Types

This section is empty.

Jump to

Keyboard shortcuts

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