env

package
v0.0.76 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeOSEnv

func EncodeOSEnv(key, val string) string

EncodeOSEnv encodes an environment variable for use in an OS environment.

func EncodeOSEnvFunc

func EncodeOSEnvFunc(key, val string, fn callback) string

EncodeOSEnvFunc encodes an environment variable for use in an OS environment using a custom sprintf function.

func EncodeOSEnvWithSecret

func EncodeOSEnvWithSecret(key, val string) string

func GetEnv

func GetEnv(opts GetEnvOptions) ([]string, error)

GetEnv will return the environment variables for the given environment and group.

func GetSecretNameForEnv

func GetSecretNameForEnv(env string, group string) string

func IsValueSecret

func IsValueSecret(val string) (bool, string)

func ProcessSecrets

func ProcessSecrets(ctx context.Context, logger logger.Logger, projectID string, env string, group string, callback secretCallback) error

func SetEnvFromEnvFile

func SetEnvFromEnvFile(envfile string) error

SetEnvFromEnvFile will set the environment variables from an env file.

func WriteEnvFile

func WriteEnvFile(fn string, envs []EnvLine) error

Types

type EnvLine

type EnvLine struct {
	Key      string `json:"key"`
	Val      string `json:"val"`
	IsSecret bool   `json:"secret,omitempty"`
}

func ParseEnvBuffer

func ParseEnvBuffer(buf []byte) ([]EnvLine, error)

ParseEnvBuffer parses an environment file from a buffer and returns a list of EnvLine structs.

func ParseEnvFile

func ParseEnvFile(filename string) ([]EnvLine, error)

ParseEnvFile parses an environment file and returns a list of EnvLine structs.

func ParseEnvValue

func ParseEnvValue(key, val string) EnvLine

func ProcessEnvLine

func ProcessEnvLine(env string) EnvLine

ProcessEnvLine processes an environment variable line and returns an EnvLine struct with the key, value, and secret flag set.

type GetEnvOptions

type GetEnvOptions struct {
	Cmd         *cobra.Command
	Logger      logger.Logger
	Dir         string
	SkipSecrets bool
	SkipOSEnvs  bool
	SetEnv      bool
	EnvName     string
	GroupName   string
}

Jump to

Keyboard shortcuts

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