envparser

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package envparser contains environment parsing and functions around it

Package envparser contains environment parsing and functions around it

Package envparser contains environment parsing and functions around it

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDefaultEnvs

func CreateDefaultEnvs(envName *string) error

CreateDefaultEnvs Creates environment folder and a default global.env file in it. Optional: File names as a *string

func CreateEnvDirAndFiles

func CreateEnvDirAndFiles(fileName string) (string, error)

CreateEnvDirAndFiles Creates an env directory and a fileName inside it. Returns envfilePath and errors associated with it

func GenerateSecretsMap

func GenerateSecretsMap(envFromFlag string) (map[string]any, error)

GenerateSecretsMap creates final map of environment variables and it's values User's Choice > Global. When user has custom env they want to use, it merges custom with global env. Replaces global key with custom when keys repeat

func LoadEnvVars

func LoadEnvVars(filePath string) (map[string]any, error)

LoadEnvVars returns map of the key-value pair from the provided .env filepath

func SubstituteVariables

func SubstituteVariables(
	strToChange string,
	secretsMap map[string]any,
) (any, error)

SubstituteVariables Substitutes template variables in a given string strToChange using the secretsMap. It first prepares the map by resolving all nested variables using prepareMap and then applies replaceVariables to the input string. Returns the final substituted string or an error if any step fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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