env

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

README

Env

The core/env package provides functionality for ensuring we retrieve an environment variable

Example

Loading default environment config
env.TryLoadDefault()
Loading default environment config together with other source
env.TryLoadDefault("package/other.env")
Expect environment variable to be set
dbURL := env.MustGet("DATABASE_URL")

Documentation

Overview

Package env provides functionality for ensuring we retrieve an environment variable

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustGet

func MustGet(name string) string

MustGet returns an environment variable by name If the requested variable does not exist, we throw a fatal error

Example
package main

import (
	"log"

	"github.com/LUSHDigital/core/env"
)

func main() {
	var dbURL = env.MustGet("DATABASE_URL")
	log.Println(dbURL)
}
Output:

func TryLoadDefault added in v0.5.3

func TryLoadDefault(paths ...string)

TryLoadDefault will attempt to load the default environment variables.

Example
package main

import (
	"github.com/LUSHDigital/core/env"
)

func main() {
	env.TryLoadDefault()
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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