envread

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAndWriteSecretsFromEnv

func CreateAndWriteSecretsFromEnv(secretname, region, filePath string) error

func LoadEnvFile

func LoadEnvFile(filePath string) (map[string]string, error)

LoadEnvFile reads a .env file from the specified file path and returns a map of environment variables. The .env file should have lines in the format KEY=VALUE. Lines that are empty or start with a '#' are ignored. If a line does not contain an '=' character, an error is returned.

Parameters:

  • filePath: The path to the .env file to be read.

Returns:

  • A map where the keys are environment variable names and the values are the corresponding values.
  • An error if the file cannot be opened, read, or contains invalid lines.

func UpdateSecretsFromEnvFile

func UpdateSecretsFromEnvFile(secretname, region, filePath string) error

UpdateSecretsFromEnvFile updates secrets in a specified secret manager from a .env file. It loads environment variables from the given file and updates each key-value pair in the secret manager.

Parameters:

  • secretname: The name of the secret to update.
  • region: The region where the secret is stored.
  • filePath: The path to the .env file containing the environment variables.

Returns:

  • error: An error if the .env file cannot be loaded or if any secret update fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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