[XAPID-999] fix duplicate config in response, added configuration to provide configBundleBlobDownloadEndpoint
diff --git a/api.go b/api.go
index 5d4f748..fd41fb8 100644
--- a/api.go
+++ b/api.go
@@ -375,6 +375,11 @@
}
func getHttpHost() string {
+
+ configuredEndpoint := config.GetString(configBundleBlobDownloadEndpoint)
+ if configuredEndpoint != "" {
+ return configuredEndpoint
+ }
// apid-core has to set this according to the protocol apid is to be run: http/https
proto := config.GetString(configProtocol)
if proto == "" {
diff --git a/data.go b/data.go
index 80beedd..e02cf60 100644
--- a/data.go
+++ b/data.go
@@ -140,24 +140,48 @@
// TODO there's a bug in the db statement
func (dbc *dbManager) getReadyDeployments() ([]DataDeployment, error) {
- rows, err := dbc.getDb().Query(`SELECT
- a.id,
- a.organization_id,
- a.environment_id,
- a.bean_blob_id,
- a.resource_blob_id,
- a.type,
- a.name,
- a.revision,
- a.path,
- a.created_at,
- a.created_by,
- a.updated_at,
- a.updated_by,
- b.local_fs_location
- FROM metadata_runtime_entity_metadata as a
- INNER JOIN edgex_blob_available as b
- ON (a.bean_blob_id = b.id OR a.resource_blob_id = b.id)
+ rows, err := dbc.getDb().Query(`
+ SELECT a.id,
+ a.organization_id,
+ a.environment_id,
+ a.bean_blob_id,
+ a.resource_blob_id,
+ a.type,
+ a.name,
+ a.revision,
+ a.path,
+ a.created_at,
+ a.created_by,
+ a.updated_at,
+ a.updated_by,
+ b.local_fs_location
+ FROM metadata_runtime_entity_metadata as a
+ INNER JOIN edgex_blob_available as b
+ ON (a.bean_blob_id = b.id)
+ WHERE a.id IN (
+ SELECT
+ a.id
+ FROM metadata_runtime_entity_metadata as a
+ INNER JOIN edgex_blob_available as b
+ ON a.resource_blob_id = b.id
+ WHERE a.resource_blob_id != ""
+ INTERSECT
+ SELECT
+ a.id
+ FROM metadata_runtime_entity_metadata as a
+ INNER JOIN edgex_blob_available as b
+ ON a.resource_blob_id = b.id
+ WHERE a.resource_blob_id != ""
+
+ UNION
+ SELECT
+ a.id
+ FROM metadata_runtime_entity_metadata as a
+ INNER JOIN edgex_blob_available as b
+ ON a.bean_blob_id = b.id
+ WHERE a.resource_blob_id = ""
+ )
+
;
`)
diff --git a/init.go b/init.go
index d70963d..43ae0e0 100644
--- a/init.go
+++ b/init.go
@@ -25,20 +25,21 @@
)
const (
- configProtocol = "protocol_type"
- configAPIListen = "api_listen"
- configBundleDirKey = "gatewaydeploy_bundle_dir"
- configDebounceDuration = "gatewaydeploy_debounce_duration"
- configBundleCleanupDelay = "gatewaydeploy_bundle_cleanup_delay"
- configMarkDeployFailedAfter = "gatewaydeploy_deployment_timeout"
- configDownloadConnTimeout = "gatewaydeploy_download_connection_timeout"
- configApiServerBaseURI = "apigeesync_proxy_server_base"
- configApidInstanceID = "apigeesync_apid_instance_id"
- configApidClusterID = "apigeesync_cluster_id"
- configConcurrentDownloads = "apigeesync_concurrent_downloads"
- configDownloadQueueSize = "apigeesync_download_queue_size"
- configBlobServerBaseURI = "apigeesync_blob_server_base"
- configStoragePath = "local_storage_path"
+ configProtocol = "protocol_type"
+ configAPIListen = "api_listen"
+ configBundleBlobDownloadEndpoint = "gatewaydeploy_bundle_download_endpoint"
+ configBundleDirKey = "gatewaydeploy_bundle_dir"
+ configDebounceDuration = "gatewaydeploy_debounce_duration"
+ configBundleCleanupDelay = "gatewaydeploy_bundle_cleanup_delay"
+ configMarkDeployFailedAfter = "gatewaydeploy_deployment_timeout"
+ configDownloadConnTimeout = "gatewaydeploy_download_connection_timeout"
+ configApiServerBaseURI = "apigeesync_proxy_server_base"
+ configApidInstanceID = "apigeesync_apid_instance_id"
+ configApidClusterID = "apigeesync_cluster_id"
+ configConcurrentDownloads = "apigeesync_concurrent_downloads"
+ configDownloadQueueSize = "apigeesync_download_queue_size"
+ configBlobServerBaseURI = "apigeesync_blob_server_base"
+ configStoragePath = "local_storage_path"
)
var (