Updated to allow for multiple bundles to stood up with standalone. (#4) * Updated to allow for multiple bundles to stood up with standalone. * Removing the glide.lock file to get rid of conflicts. * Fixing issue with glide.lock
diff --git a/cmd/apidGatewayDeploy/main.go b/cmd/apidGatewayDeploy/main.go index 4cb1163..32de317 100644 --- a/cmd/apidGatewayDeploy/main.go +++ b/cmd/apidGatewayDeploy/main.go
@@ -2,12 +2,16 @@ import ( "flag" + "io/ioutil" + "os" + "strings" + + "fmt" + "github.com/30x/apid" "github.com/30x/apid/factory" - _ "github.com/30x/apidGatewayDeploy" - "io/ioutil" "github.com/30x/apidGatewayDeploy" - "os" + _ "github.com/30x/apidGatewayDeploy" ) func main() { @@ -51,9 +55,19 @@ apid.InitializePlugins() if bundleFile != "" { - err := insertTestDeployment(bundleFile, bundleConfig) - if err != nil { - log.Fatal(err) + if strings.ContainsAny(bundleFile, ",") { + for deploymentCount, singleBundleFile := range strings.Split(bundleFile, ",") { + deployment := fmt.Sprintf("testDeployment-%d", deploymentCount) + err := insertTestDeployment(singleBundleFile, bundleConfig, deployment) + if err != nil { + log.Fatal(err) + } + } + } else { + err := insertTestDeployment(bundleFile, bundleConfig, "testDeployment") + if err != nil { + log.Fatal(err) + } } } @@ -70,27 +84,25 @@ log.Fatalf("Error. Is something already running on port %d? %s", port, err) } -func insertTestDeployment(bundleFile, bundleConfig string) error { - - deploymentID := "testDeployment" +func insertTestDeployment(bundleFile, bundleConfig string, deploymentID string) error { dep := apiGatewayDeploy.DataDeployment{ - ID: deploymentID, - BundleConfigID: deploymentID, - ApidClusterID: deploymentID, - DataScopeID: deploymentID, - BundleConfigJSON: bundleConfig, - ConfigJSON: "", - Status: "", - Created: "", - CreatedBy: "", - Updated: "", - UpdatedBy: "", - BundleName: deploymentID, - BundleURI: bundleFile, - BundleChecksum: "", + ID: deploymentID, + BundleConfigID: deploymentID, + ApidClusterID: deploymentID, + DataScopeID: deploymentID, + BundleConfigJSON: bundleConfig, + ConfigJSON: "", + Status: "", + Created: "", + CreatedBy: "", + Updated: "", + UpdatedBy: "", + BundleName: deploymentID, + BundleURI: bundleFile, + BundleChecksum: "", BundleChecksumType: "", - LocalBundleURI: bundleFile, + LocalBundleURI: bundleFile, } log := apid.Log() @@ -125,4 +137,4 @@ apiGatewayDeploy.InitAPI() return nil -} \ No newline at end of file +}