env

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key string) string

func GetEnv

func GetEnv() string

GetEnv Get env variable from the System. Example for test.golang-template.internal.com is test.

func GetScope

func GetScope() string

GetScope Get scope name from the System. Priority order is as follows:

-1. It looks in "app.scope" system property.
-2. If empty, it looks in ENV system env variable
	-2.1. If empty, it is a local scope
	-2.2. If not empty and starts with "test," it is a test scope
	-2.3. Otherwise, it is a "prod" environment.

func IsEmptyString

func IsEmptyString(value string) bool

func IsLocal

func IsLocal() bool

func IsRemote

func IsRemote() bool

func Load

func Load() error

Load SCOPE LOCAL (local) or REMOTE (remote) ENV DEV|UAT|REMOTE.

func Reset

func Reset()

Reset only for test.

func SetConfig

func SetConfig(cfg *Config)

SetConfig set custom config.

func SetConfigFile

func SetConfigFile(configFile string)

SetConfigFile "config.yaml" by default.

func SetConfigPath

func SetConfigPath(configPath string)

SetConfigPath "config" from root by default.

func SetLogger

func SetLogger(logger *slog.Logger)

SetLogger text warn logger by default.

Types

type Config

type Config struct {
	File   string
	Path   string
	Logger *slog.Logger
}

func New

func New() *Config

type Scope

type Scope int
const (
	LOCAL Scope = iota
	REMOTE
)

func (Scope) String

func (s Scope) String() string

Jump to

Keyboard shortcuts

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