envs

package
v0.18.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 4 Imported by: 11

Documentation

Index

Constants

View Source
const (
	ENABLED = "true"
)

Variables

View Source
var ErrParse = errors.New("failed to parse environment variables")
View Source
var ErrParseWithPrefix = errors.New("failed to parse environment variables for the given prefix")

Functions

func HasBilling added in v0.8.0

func HasBilling() bool

HasBilling returns true if the current ShellHub server instance has billing feature enabled.

func IsCloud

func IsCloud() bool

IsCloud returns true if the current ShellHub server instance is cloud.

func IsCommunity added in v0.12.5

func IsCommunity() bool

IsCommunity return true if the current ShellHub server instance is community. It evaluates if the current ShellHub instance is neither enterprise or cloud .

func IsDevelopment added in v0.14.0

func IsDevelopment() bool

IsDevelopment returns true if the current environment is development

func IsEnterprise

func IsEnterprise() bool

IsEnterprise returns true if the current ShellHub server instance is enterprise.

func Parse added in v0.13.3

func Parse[T any]() (*T, error)

Parse parses the environment variables.

This function uses the envconfig package as its default backend, so it requires the struct to be annotated with the envconfig tags. Check the envconfig documentation for more information.

The T generic parameter must be a struct with the fields annotated with the envconfig tags, that will be returned with the values parsed from the environment variables.

func ParseWithPrefix added in v0.13.0

func ParseWithPrefix[T any](prefix string) (*T, error)

ParseWithPrefix parses the environment variables for the a given prefix.

This function uses the envconfig package as its default backend, so it requires the struct to be annotated with the envconfig tags. Check the envconfig documentation for more information.

The T generic parameter must be a struct with the fields annotated with the envconfig tags, that will be returned with the values parsed from the environment variables.

Types

type Backend

type Backend interface {
	Get(key string) string
	Process(prefix string, spec interface{}) error
}

Backend is an interface for any sort of underlying key/value store.

var DefaultBackend Backend

DefaultBackend define the backend to be used to get environment variables.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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