Skip to content

Commit b78add1

Browse files
Merge pull request #304 from Sanketika-Obsrv/data-schema-fix
fix: #OBS-I406 storage type support envs as json
2 parents b1e9744 + 30c0b28 commit b78add1

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

api-service/src/configs/Config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,5 @@ export const config = {
119119
"enable": process.env.otel_enable || "false",
120120
"collector_endpoint": process.env.otel_collector_endpoint || "http://localhost:4318"
121121
},
122-
"storage_types": process.env.storage_types || 'druid,datalake'
122+
"storage_types": process.env.storage_types || '{"lake_house":true,"realtime_store":true}'
123123
}

api-service/src/services/DatasetService.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,15 @@ export const getV1Connectors = async (datasetId: string) => {
412412
return modifiedV1Connectors;
413413
}
414414

415-
const storageTypes = _.split(config.storage_types, ",")
415+
const storageTypes = JSON.parse(config.storage_types)
416416
export const validateStorageSupport = (dataset: Record<string, any>) => {
417417
const { olap_store_enabled, lakehouse_enabled } = _.get(dataset, ["dataset_config", "indexing_config"]) || {}
418-
if (olap_store_enabled && !_.includes(storageTypes, "druid")) {
419-
throw obsrvError("", "DATASET_UNSUPPORTED_STORAGE_TYPE", `The storage type "olap_store" is not available. Please use one of the available storage types: ${storageTypes}`, "BAD_REQUEST", 400)
418+
const validStorageType = _.keys(storageTypes).filter(key => storageTypes[key] === true);
419+
if (olap_store_enabled && !_.get(storageTypes, "realtime_store") === true) {
420+
throw obsrvError("", "DATASET_UNSUPPORTED_STORAGE_TYPE", `The storage type "realtime_store" is not available. Please use one of the available storage types: ${validStorageType}`, "BAD_REQUEST", 400)
420421
}
421-
if (lakehouse_enabled && !_.includes(storageTypes, "datalake")) {
422-
throw obsrvError("", "DATASET_UNSUPPORTED_STORAGE_TYPE", `The storage type "datalake" is not available. Please use one of the available storage types: ${storageTypes}`, "BAD_REQUEST", 400)
422+
if (lakehouse_enabled && !_.get(storageTypes, "lake_house") == true) {
423+
throw obsrvError("", "DATASET_UNSUPPORTED_STORAGE_TYPE", `The storage type "lake_house" is not available. Please use one of the available storage types: ${validStorageType}`, "BAD_REQUEST", 400)
423424
}
424425
}
425426

0 commit comments

Comments
 (0)