Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeEnvEncVariablesFromFile ¶ added in v0.34.0
InitializeEnvEncVariablesFromFile initializes environment variables from encrypted vault files on the filesystem based on the application environment.
Business logic:
- Requires ENV_ENCRYPTION_KEY_PUBLIC and ENV_ENCRYPTION_KEY_PRIVATE environment variables
- Looks for vault file named ".env.<app_environment>.vault" in the local filesystem
- Derives encryption key from public and private keys using envenc.DeriveKey
- Hydrates environment variables from the vault file using envenc.HydrateEnvFromFile
Parameters: - appEnvironment: The application environment (e.g., "development", "production", "staging") - publicKey: The public encryption key (typically from ENV_ENCRYPTION_KEY_PUBLIC) - privateKey: The private encryption key (typically from ENV_ENCRYPTION_KEY_PRIVATE)
Returns: - error: If any step fails (missing keys, vault file not found, decryption failed, etc.)
func InitializeEnvEncVariablesFromResources ¶ added in v0.34.0
func InitializeEnvEncVariablesFromResources(appEnvironment, publicKey, privateKey string, resourceLoader func(string) (string, error)) error
InitializeEnvEncVariablesFromResources initializes environment variables from encrypted vault files from embedded resources based on the application environment.
Business logic:
- Requires ENV_ENCRYPTION_KEY_PUBLIC and ENV_ENCRYPTION_KEY_PRIVATE environment variables
- Looks for vault resource named ".env.<app_environment>.vault" in embedded resources
- Derives encryption key from public and private keys using envenc.DeriveKey
- Hydrates environment variables from the vault content using envenc.HydrateEnvFromString
Parameters: - appEnvironment: The application environment (e.g., "development", "production", "staging") - publicKey: The public encryption key (typically from ENV_ENCRYPTION_KEY_PUBLIC) - privateKey: The private encryption key (typically from ENV_ENCRYPTION_KEY_PRIVATE) - resourceLoader: Function to load embedded resources, returns vault content
Returns: - error: If any step fails (missing keys, resource not found, decryption failed, etc.)
Types ¶
type ConfigInterface ¶
type ConfigInterface interface {
object.SerializablePropertyObjectInterface
}
ConfigInterface represents the application configuration
type EnvEncConfig ¶ added in v0.34.0
EnvEncConfig represents the environment encryption configuration
type EnvEncError ¶ added in v0.34.0
EnvEncError represents an error during environment encryption operations
func (*EnvEncError) Error ¶ added in v0.34.0
func (e *EnvEncError) Error() string
type MissingEnvError ¶ added in v0.34.0
MissingEnvError represents an error when a required environment variable is missing
func (*MissingEnvError) Error ¶ added in v0.34.0
func (e *MissingEnvError) Error() string