Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ const (
DEFAULT_NETWORK_CIDR = "10.5.0.0/16"
)

// Kubernetes settings
const (
KUBERNETES_SHORT_TIMEOUT = 200 * time.Millisecond
)

// Minimum versions for tools
const (
MINIMUM_VERSION_COLIMA = "0.7.0"
Expand Down
31 changes: 23 additions & 8 deletions pkg/env/aws_env.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// The AwsEnvPrinter is a specialized component that manages AWS environment configuration.
// It provides AWS-specific environment variable management and configuration,
// The AwsEnvPrinter handles AWS profile, endpoint, and S3 configuration settings,
// ensuring proper AWS CLI integration and environment setup for AWS operations.

package env

import (
Expand All @@ -8,20 +13,30 @@ import (
"github.com/windsorcli/cli/pkg/di"
)

// AwsEnvPrinter is a struct that simulates an AWS environment for testing purposes.
// =============================================================================
// Types
// =============================================================================

// AwsEnvPrinter is a struct that implements AWS environment configuration
type AwsEnvPrinter struct {
BaseEnvPrinter
}

// NewAwsEnvPrinter initializes a new awsEnv instance using the provided dependency injector.
// =============================================================================
// Constructor
// =============================================================================

// NewAwsEnvPrinter creates a new AwsEnvPrinter instance
func NewAwsEnvPrinter(injector di.Injector) *AwsEnvPrinter {
return &AwsEnvPrinter{
BaseEnvPrinter: BaseEnvPrinter{
injector: injector,
},
BaseEnvPrinter: *NewBaseEnvPrinter(injector),
}
}

// =============================================================================
// Public Methods
// =============================================================================

// GetEnvVars retrieves the environment variables for the AWS environment.
func (e *AwsEnvPrinter) GetEnvVars() (map[string]string, error) {
envVars := make(map[string]string)
Expand All @@ -42,13 +57,13 @@ func (e *AwsEnvPrinter) GetEnvVars() (map[string]string, error) {

// Construct the path to the AWS configuration file and verify its existence.
awsConfigPath := filepath.Join(configRoot, ".aws", "config")
if _, err := stat(awsConfigPath); os.IsNotExist(err) {
if _, err := e.shims.Stat(awsConfigPath); os.IsNotExist(err) {
awsConfigPath = ""
}

// Populate environment variables with AWS configuration data.
if awsConfigPath != "" {
envVars["AWS_CONFIG_FILE"] = awsConfigPath
envVars["AWS_CONFIG_FILE"] = filepath.ToSlash(awsConfigPath)
}
if contextConfigData.AWS.AWSProfile != nil {
envVars["AWS_PROFILE"] = *contextConfigData.AWS.AWSProfile
Expand Down Expand Up @@ -77,5 +92,5 @@ func (e *AwsEnvPrinter) Print() error {
return e.BaseEnvPrinter.Print(envVars)
}

// Ensure awsEnv implements the EnvPrinter interface
// Ensure AwsEnvPrinter implements the EnvPrinter interface
var _ EnvPrinter = (*AwsEnvPrinter)(nil)
Loading
Loading