env

package module
v0.0.0-...-12a71a9 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 3 Imported by: 0

README

                           ___   _ __   __   __
                          / _ \ | '_ \ \ \ / /
                         |  __/ | | | | \ V / 
                          \___| |_| |_|  \_/  

GoDoc Go Report Card GitHub Workflow Status codecov License

The env package provides a structure for setting and identifying the Environment an application is running in.

env

import "github.com/agentstation/env"

Package env provides a structure for setting and identifying the environment an application is running in.

Index

func Set

func Set(env Environment)

Set sets the current environment

type Environment

Environment represents the application environment

type Environment string

const (
    // PROD is the production environment
    PROD Environment = "PROD"

    // STAGE is the staging environment
    STAGE Environment = "STAGE"

    // DEV is the development environment
    DEV Environment = "DEV"
)

func Current
func Current() Environment

Current returns the current environment

func Parse
func Parse(env string) Environment

Parse converts a string to an Environment type

func (Environment) IsDev
func (e Environment) IsDev() bool

IsDev returns true if the Environment is DEV

func (Environment) IsProd
func (e Environment) IsProd() bool

IsProd returns true if the Environment is PROD

func (Environment) IsStage
func (e Environment) IsStage() bool

IsStage returns true if the Environment is STAGE

func (Environment) String
func (e Environment) String() string

String returns a human-readable string representation of the Environment

Generated by gomarkdoc

Documentation

Overview

Package env provides a structure for setting and identifying the environment an application is running in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Set

func Set(env Environment)

Set sets the current environment

Types

type Environment

type Environment string

Environment represents the application environment

const (
	// PROD is the production environment
	PROD Environment = "PROD"

	// STAGE is the staging environment
	STAGE Environment = "STAGE"

	// DEV is the development environment
	DEV Environment = "DEV"
)

func Current

func Current() Environment

Current returns the current environment

func Parse

func Parse(env string) Environment

Parse converts a string to an Environment type

func (Environment) IsDev

func (e Environment) IsDev() bool

IsDev returns true if the Environment is DEV

func (Environment) IsProd

func (e Environment) IsProd() bool

IsProd returns true if the Environment is PROD

func (Environment) IsStage

func (e Environment) IsStage() bool

IsStage returns true if the Environment is STAGE

func (Environment) String

func (e Environment) String() string

String returns a human-readable string representation of the Environment

Jump to

Keyboard shortcuts

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