From 5918ba5db6a719cfc98eaaf8b4d4d27938dd85cd Mon Sep 17 00:00:00 2001 From: Richard Robert Reitz Date: Thu, 9 Oct 2025 11:08:19 +0200 Subject: [PATCH] fix(refactor): aligned all env vars --- internal/adapters/driving/cli/apply.go | 10 ++--- sdk/README.md | 4 +- sdk/examples/comprehensive/main.go | 54 +++++++++++++------------- sdk/examples/deploy_app.go | 10 ++--- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/internal/adapters/driving/cli/apply.go b/internal/adapters/driving/cli/apply.go index a204554..3cd9c27 100644 --- a/internal/adapters/driving/cli/apply.go +++ b/internal/adapters/driving/cli/apply.go @@ -74,10 +74,10 @@ func runApply(configPath string, isDryRun bool, autoApprove bool) error { fmt.Printf("✅ Configuration loaded successfully: %s\n", cfg.Metadata.Name) // Step 3: Create EdgeConnect client - baseURL := getEnvOrDefault("EDGEXR_BASE_URL", "https://hub.apps.edge.platform.mg3.mdb.osc.live") - token := getEnvOrDefault("EDGEXR_TOKEN", "") - username := getEnvOrDefault("EDGEXR_USERNAME", "") - password := getEnvOrDefault("EDGEXR_PASSWORD", "") + baseURL := getEnvOrDefault("EDGE_CONNECT_BASE_URL", "https://hub.apps.edge.platform.mg3.mdb.osc.live") + token := getEnvOrDefault("EDGE_CONNECT_TOKEN", "") + username := getEnvOrDefault("EDGE_CONNECT_USERNAME", "") + password := getEnvOrDefault("EDGE_CONNECT_PASSWORD", "") var client *edgeconnect_client.Client @@ -95,7 +95,7 @@ func runApply(configPath string, isDryRun bool, autoApprove bool) error { edgeconnect_client.WithLogger(log.Default()), ) } else { - log.Fatal("Authentication required: Set either EDGEXR_TOKEN or both EDGEXR_USERNAME and EDGEXR_PASSWORD") + log.Fatal("Authentication required: Set either EDGE_CONNECT_TOKEN or both EDGE_CONNECT_USERNAME and EDGE_CONNECT_PASSWORD") } // Step 4: Create driven adapter diff --git a/sdk/README.md b/sdk/README.md index 0f16b12..6f6a4de 100644 --- a/sdk/README.md +++ b/sdk/README.md @@ -125,14 +125,14 @@ client := client.NewClient(baseURL, ### Simple App Deployment ```bash # Run basic example -EDGEXR_USERNAME=user EDGEXR_PASSWORD=pass go run sdk/examples/deploy_app.go +EDGE_CONNECT_USERNAME=user EDGE_CONNECT_PASSWORD=pass go run sdk/examples/deploy_app.go ``` ### Comprehensive Workflow ```bash # Run full workflow demonstration cd sdk/examples/comprehensive -EDGEXR_USERNAME=user EDGEXR_PASSWORD=pass go run main.go +EDGE_CONNECT_USERNAME=user EDGE_CONNECT_PASSWORD=pass go run main.go ``` ## Authentication Methods diff --git a/sdk/examples/comprehensive/main.go b/sdk/examples/comprehensive/main.go index faa9adc..c65a158 100644 --- a/sdk/examples/comprehensive/main.go +++ b/sdk/examples/comprehensive/main.go @@ -18,12 +18,12 @@ import ( func main() { // Configure SDK client - baseURL := getEnvOrDefault("EDGEXR_BASE_URL", "https://hub.apps.edge.platform.mg3.mdb.osc.live") + baseURL := getEnvOrDefault("EDGE_CONNECT_BASE_URL", "https://hub.apps.edge.platform.mg3.mdb.osc.live") // Support both authentication methods - token := getEnvOrDefault("EDGEXR_TOKEN", "") - username := getEnvOrDefault("EDGEXR_USERNAME", "") - password := getEnvOrDefault("EDGEXR_PASSWORD", "") + token := getEnvOrDefault("EDGE_CONNECT_TOKEN", "") + username := getEnvOrDefault("EDGE_CONNECT_USERNAME", "") + password := getEnvOrDefault("EDGE_CONNECT_PASSWORD", "") var client *edgeconnect_client.Client @@ -41,7 +41,7 @@ func main() { edgeconnect_client.WithLogger(log.Default()), ) } else { - log.Fatal("Authentication required: Set either EDGEXR_TOKEN or both EDGEXR_USERNAME and EDGEXR_PASSWORD") + log.Fatal("Authentication required: Set either EDGE_CONNECT_TOKEN or both EDGE_CONNECT_USERNAME and EDGE_CONNECT_PASSWORD") } adapter := edgeconnect.NewAdapter(client) @@ -134,12 +134,12 @@ func runComprehensiveWorkflow(ctx context.Context, adapter *edgeconnect.Adapter, Name: app.App.Key.Name, Version: app.App.Key.Version, }, - Deployment: app.App.Deployment, - ImageType: app.App.ImageType, - ImagePath: app.App.ImagePath, - DefaultFlavor: domain.Flavor{Name: app.App.DefaultFlavor.Name}, - ServerlessConfig: app.App.ServerlessConfig, - AllowServerless: app.App.AllowServerless, + Deployment: app.App.Deployment, + ImageType: app.App.ImageType, + ImagePath: app.App.ImagePath, + DefaultFlavor: domain.Flavor{Name: app.App.DefaultFlavor.Name}, + ServerlessConfig: app.App.ServerlessConfig, + AllowServerless: app.App.AllowServerless, RequiredOutboundConnections: toDomainSecurityRules(app.App.RequiredOutboundConnections), } @@ -318,12 +318,12 @@ func runComprehensiveWorkflow(ctx context.Context, adapter *edgeconnect.Adapter, // 10. Try to Get Cloudlet Resource Usage (may not be available in demo) fmt.Println("\n🔟 Attempting to retrieve cloudlet resource usage...") - domainCloudletKey = domain.CloudletKey{ - Organization: cloudletKey.Organization, - Name: cloudletKey.Name, - } - usage, err := adapter.GetCloudletResourceUsage(ctx, domainCloudletKey, config.Region) - if err != nil { + domainCloudletKey = domain.CloudletKey{ + Organization: cloudletKey.Organization, + Name: cloudletKey.Name, + } + usage, err := adapter.GetCloudletResourceUsage(ctx, domainCloudletKey, config.Region) + if err != nil { fmt.Printf("⚠️ Could not retrieve cloudlet usage: %v\n", err) } else { fmt.Printf("✅ Cloudlet resource usage retrieved\n") @@ -362,12 +362,12 @@ func runComprehensiveWorkflow(ctx context.Context, adapter *edgeconnect.Adapter, fmt.Printf("✅ App deleted: %s/%s v%s\n", config.Organization, config.AppName, config.AppVersion) // 13. Verify Cleanup - fmt.Println("\n1️⃣3️⃣ Verifying cleanup...") - domainAppKey = domain.AppKey{ - Organization: appKey.Organization, - Name: appKey.Name, - Version: appKey.Version, - } + fmt.Println("\n1️⃣3️⃣ Verifying cleanup...") + domainAppKey = domain.AppKey{ + Organization: appKey.Organization, + Name: appKey.Name, + Version: appKey.Version, + } _, err = adapter.ShowApp(ctx, config.Region, domainAppKey) if err != nil && domain.IsNotFoundError(err) { fmt.Printf("✅ Cleanup verified - app no longer exists\n") @@ -472,10 +472,10 @@ type NewAppInstanceInput struct { } type AppInstance struct { - Key AppInstanceKey - AppKey AppKey - Flavor Flavor - State string + Key AppInstanceKey + AppKey AppKey + Flavor Flavor + State string PowerState string } diff --git a/sdk/examples/deploy_app.go b/sdk/examples/deploy_app.go index 55cf405..90e2473 100644 --- a/sdk/examples/deploy_app.go +++ b/sdk/examples/deploy_app.go @@ -18,12 +18,12 @@ import ( func main() { // Configure SDK client - baseURL := getEnvOrDefault("EDGEXR_BASE_URL", "https://hub.apps.edge.platform.mg3.mdb.osc.live") + baseURL := getEnvOrDefault("EDGE_CONNECT_BASE_URL", "https://hub.apps.edge.platform.mg3.mdb.osc.live") // Support both token-based and username/password authentication - token := getEnvOrDefault("EDGEXR_TOKEN", "") - username := getEnvOrDefault("EDGEXR_USERNAME", "") - password := getEnvOrDefault("EDGEXR_PASSWORD", "") + token := getEnvOrDefault("EDGE_CONNECT_TOKEN", "") + username := getEnvOrDefault("EDGE_CONNECT_USERNAME", "") + password := getEnvOrDefault("EDGE_CONNECT_PASSWORD", "") var client *edgeconnect_client.Client @@ -43,7 +43,7 @@ func main() { edgeconnect_client.WithLogger(log.Default()), ) } else { - log.Fatal("Authentication required: Set either EDGEXR_TOKEN or both EDGEXR_USERNAME and EDGEXR_PASSWORD") + log.Fatal("Authentication required: Set either EDGE_CONNECT_TOKEN or both EDGE_CONNECT_USERNAME and EDGE_CONNECT_PASSWORD") } adapter := edgeconnect.NewAdapter(client)