fix(refactor): aligned all env vars
This commit is contained in:
parent
5ac67a224d
commit
5918ba5db6
4 changed files with 39 additions and 39 deletions
|
|
@ -74,10 +74,10 @@ func runApply(configPath string, isDryRun bool, autoApprove bool) error {
|
||||||
fmt.Printf("✅ Configuration loaded successfully: %s\n", cfg.Metadata.Name)
|
fmt.Printf("✅ Configuration loaded successfully: %s\n", cfg.Metadata.Name)
|
||||||
|
|
||||||
// Step 3: Create EdgeConnect client
|
// Step 3: Create EdgeConnect 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")
|
||||||
token := getEnvOrDefault("EDGEXR_TOKEN", "")
|
token := getEnvOrDefault("EDGE_CONNECT_TOKEN", "")
|
||||||
username := getEnvOrDefault("EDGEXR_USERNAME", "")
|
username := getEnvOrDefault("EDGE_CONNECT_USERNAME", "")
|
||||||
password := getEnvOrDefault("EDGEXR_PASSWORD", "")
|
password := getEnvOrDefault("EDGE_CONNECT_PASSWORD", "")
|
||||||
|
|
||||||
var client *edgeconnect_client.Client
|
var client *edgeconnect_client.Client
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ func runApply(configPath string, isDryRun bool, autoApprove bool) error {
|
||||||
edgeconnect_client.WithLogger(log.Default()),
|
edgeconnect_client.WithLogger(log.Default()),
|
||||||
)
|
)
|
||||||
} else {
|
} 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
|
// Step 4: Create driven adapter
|
||||||
|
|
|
||||||
|
|
@ -125,14 +125,14 @@ client := client.NewClient(baseURL,
|
||||||
### Simple App Deployment
|
### Simple App Deployment
|
||||||
```bash
|
```bash
|
||||||
# Run basic example
|
# 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
|
### Comprehensive Workflow
|
||||||
```bash
|
```bash
|
||||||
# Run full workflow demonstration
|
# Run full workflow demonstration
|
||||||
cd sdk/examples/comprehensive
|
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
|
## Authentication Methods
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,12 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Configure SDK client
|
// 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
|
// Support both authentication methods
|
||||||
token := getEnvOrDefault("EDGEXR_TOKEN", "")
|
token := getEnvOrDefault("EDGE_CONNECT_TOKEN", "")
|
||||||
username := getEnvOrDefault("EDGEXR_USERNAME", "")
|
username := getEnvOrDefault("EDGE_CONNECT_USERNAME", "")
|
||||||
password := getEnvOrDefault("EDGEXR_PASSWORD", "")
|
password := getEnvOrDefault("EDGE_CONNECT_PASSWORD", "")
|
||||||
|
|
||||||
var client *edgeconnect_client.Client
|
var client *edgeconnect_client.Client
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ func main() {
|
||||||
edgeconnect_client.WithLogger(log.Default()),
|
edgeconnect_client.WithLogger(log.Default()),
|
||||||
)
|
)
|
||||||
} else {
|
} 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)
|
adapter := edgeconnect.NewAdapter(client)
|
||||||
|
|
@ -134,12 +134,12 @@ func runComprehensiveWorkflow(ctx context.Context, adapter *edgeconnect.Adapter,
|
||||||
Name: app.App.Key.Name,
|
Name: app.App.Key.Name,
|
||||||
Version: app.App.Key.Version,
|
Version: app.App.Key.Version,
|
||||||
},
|
},
|
||||||
Deployment: app.App.Deployment,
|
Deployment: app.App.Deployment,
|
||||||
ImageType: app.App.ImageType,
|
ImageType: app.App.ImageType,
|
||||||
ImagePath: app.App.ImagePath,
|
ImagePath: app.App.ImagePath,
|
||||||
DefaultFlavor: domain.Flavor{Name: app.App.DefaultFlavor.Name},
|
DefaultFlavor: domain.Flavor{Name: app.App.DefaultFlavor.Name},
|
||||||
ServerlessConfig: app.App.ServerlessConfig,
|
ServerlessConfig: app.App.ServerlessConfig,
|
||||||
AllowServerless: app.App.AllowServerless,
|
AllowServerless: app.App.AllowServerless,
|
||||||
RequiredOutboundConnections: toDomainSecurityRules(app.App.RequiredOutboundConnections),
|
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)
|
// 10. Try to Get Cloudlet Resource Usage (may not be available in demo)
|
||||||
fmt.Println("\n🔟 Attempting to retrieve cloudlet resource usage...")
|
fmt.Println("\n🔟 Attempting to retrieve cloudlet resource usage...")
|
||||||
domainCloudletKey = domain.CloudletKey{
|
domainCloudletKey = domain.CloudletKey{
|
||||||
Organization: cloudletKey.Organization,
|
Organization: cloudletKey.Organization,
|
||||||
Name: cloudletKey.Name,
|
Name: cloudletKey.Name,
|
||||||
}
|
}
|
||||||
usage, err := adapter.GetCloudletResourceUsage(ctx, domainCloudletKey, config.Region)
|
usage, err := adapter.GetCloudletResourceUsage(ctx, domainCloudletKey, config.Region)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("⚠️ Could not retrieve cloudlet usage: %v\n", err)
|
fmt.Printf("⚠️ Could not retrieve cloudlet usage: %v\n", err)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("✅ Cloudlet resource usage retrieved\n")
|
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)
|
fmt.Printf("✅ App deleted: %s/%s v%s\n", config.Organization, config.AppName, config.AppVersion)
|
||||||
|
|
||||||
// 13. Verify Cleanup
|
// 13. Verify Cleanup
|
||||||
fmt.Println("\n1️⃣3️⃣ Verifying cleanup...")
|
fmt.Println("\n1️⃣3️⃣ Verifying cleanup...")
|
||||||
domainAppKey = domain.AppKey{
|
domainAppKey = domain.AppKey{
|
||||||
Organization: appKey.Organization,
|
Organization: appKey.Organization,
|
||||||
Name: appKey.Name,
|
Name: appKey.Name,
|
||||||
Version: appKey.Version,
|
Version: appKey.Version,
|
||||||
}
|
}
|
||||||
_, err = adapter.ShowApp(ctx, config.Region, domainAppKey)
|
_, err = adapter.ShowApp(ctx, config.Region, domainAppKey)
|
||||||
if err != nil && domain.IsNotFoundError(err) {
|
if err != nil && domain.IsNotFoundError(err) {
|
||||||
fmt.Printf("✅ Cleanup verified - app no longer exists\n")
|
fmt.Printf("✅ Cleanup verified - app no longer exists\n")
|
||||||
|
|
@ -472,10 +472,10 @@ type NewAppInstanceInput struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppInstance struct {
|
type AppInstance struct {
|
||||||
Key AppInstanceKey
|
Key AppInstanceKey
|
||||||
AppKey AppKey
|
AppKey AppKey
|
||||||
Flavor Flavor
|
Flavor Flavor
|
||||||
State string
|
State string
|
||||||
PowerState string
|
PowerState string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,12 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Configure SDK client
|
// 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
|
// Support both token-based and username/password authentication
|
||||||
token := getEnvOrDefault("EDGEXR_TOKEN", "")
|
token := getEnvOrDefault("EDGE_CONNECT_TOKEN", "")
|
||||||
username := getEnvOrDefault("EDGEXR_USERNAME", "")
|
username := getEnvOrDefault("EDGE_CONNECT_USERNAME", "")
|
||||||
password := getEnvOrDefault("EDGEXR_PASSWORD", "")
|
password := getEnvOrDefault("EDGE_CONNECT_PASSWORD", "")
|
||||||
|
|
||||||
var client *edgeconnect_client.Client
|
var client *edgeconnect_client.Client
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ func main() {
|
||||||
edgeconnect_client.WithLogger(log.Default()),
|
edgeconnect_client.WithLogger(log.Default()),
|
||||||
)
|
)
|
||||||
} else {
|
} 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)
|
adapter := edgeconnect.NewAdapter(client)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue