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)
|
||||
|
||||
// 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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue