@@ -44,11 +44,6 @@ const axiosWithTimeout = axios.create({
44
44
httpsAgent : new https . Agent ( { keepAlive : false } ) ,
45
45
} ) ;
46
46
47
- const { DUST_FRONT_API } = process . env ;
48
- if ( ! DUST_FRONT_API ) {
49
- throw new Error ( "FRONT_API not set" ) ;
50
- }
51
-
52
47
// We limit the document size we support. Beyond a certain size, upsert is simply too slow (>300s)
53
48
// and large files are generally less useful anyway.
54
49
export const MAX_DOCUMENT_TXT_LEN = 750000 ;
@@ -123,7 +118,7 @@ async function _upsertDataSourceDocument({
123
118
} ) ;
124
119
125
120
const endpoint =
126
- `${ DUST_FRONT_API } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
121
+ `${ apiConfig . getDustFrontAPIUrl ( ) } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
127
122
`/data_sources/${ dataSourceConfig . dataSourceId } /documents/${ documentId } ` ;
128
123
129
124
const localLogger = logger . child ( {
@@ -257,7 +252,7 @@ export async function getDataSourceDocument({
257
252
} ) ;
258
253
259
254
const endpoint =
260
- `${ DUST_FRONT_API } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
255
+ `${ apiConfig . getDustFrontAPIUrl ( ) } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
261
256
`/data_sources/${ dataSourceConfig . dataSourceId } /documents?document_ids=${ documentId } ` ;
262
257
const dustRequestConfig : AxiosRequestConfig = {
263
258
headers : {
@@ -288,7 +283,7 @@ export async function deleteDataSourceDocument(
288
283
const localLogger = logger . child ( { ...loggerArgs , documentId } ) ;
289
284
290
285
const endpoint =
291
- `${ DUST_FRONT_API } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
286
+ `${ apiConfig . getDustFrontAPIUrl ( ) } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
292
287
`/data_sources/${ dataSourceConfig . dataSourceId } /documents/${ documentId } ` ;
293
288
const dustRequestConfig : AxiosRequestConfig = {
294
289
headers : {
@@ -382,7 +377,7 @@ async function _updateDocumentOrTableParentsField({
382
377
? logger . child ( { ...loggerArgs , documentId : id } )
383
378
: logger . child ( { ...loggerArgs , tableId : id } ) ;
384
379
const endpoint =
385
- `${ DUST_FRONT_API } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
380
+ `${ apiConfig . getDustFrontAPIUrl ( ) } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
386
381
`/data_sources/${ dataSourceConfig . dataSourceId } /${ tableOrDocument } s/${ id } /parents` ;
387
382
const dustRequestConfig : AxiosRequestConfig = {
388
383
headers : {
@@ -663,7 +658,7 @@ export async function upsertDataSourceRemoteTable({
663
658
const now = new Date ( ) ;
664
659
665
660
const endpoint =
666
- `${ DUST_FRONT_API } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
661
+ `${ apiConfig . getDustFrontAPIUrl ( ) } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
667
662
`/data_sources/${ dataSourceConfig . dataSourceId } /tables` ;
668
663
const dustRequestPayload : UpsertDatabaseTableRequestType = {
669
664
name : tableName ,
@@ -823,7 +818,7 @@ export async function upsertDataSourceTableFromCsv({
823
818
}
824
819
825
820
const endpoint =
826
- `${ DUST_FRONT_API } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
821
+ `${ apiConfig . getDustFrontAPIUrl ( ) } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
827
822
`/data_sources/${ dataSourceConfig . dataSourceId } /tables/csv` ;
828
823
const dustRequestPayload : UpsertTableFromCsvRequestType = {
829
824
name : tableName ,
@@ -986,7 +981,7 @@ export async function deleteDataSourceTableRow({
986
981
const now = new Date ( ) ;
987
982
988
983
const endpoint =
989
- `${ DUST_FRONT_API } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
984
+ `${ apiConfig . getDustFrontAPIUrl ( ) } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
990
985
`/data_sources/${ dataSourceConfig . dataSourceId } /tables/${ tableId } /rows/${ rowId } ` ;
991
986
const dustRequestConfig : AxiosRequestConfig = {
992
987
headers : {
@@ -1068,7 +1063,7 @@ export async function _getDataSourceTable({
1068
1063
} ) ;
1069
1064
1070
1065
const endpoint =
1071
- `${ DUST_FRONT_API } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
1066
+ `${ apiConfig . getDustFrontAPIUrl ( ) } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
1072
1067
`/data_sources/${ dataSourceConfig . dataSourceId } /tables/${ tableId } ` ;
1073
1068
const dustRequestConfig : AxiosRequestConfig = {
1074
1069
headers : {
@@ -1120,7 +1115,7 @@ export async function deleteDataSourceTable({
1120
1115
const now = new Date ( ) ;
1121
1116
1122
1117
const endpoint =
1123
- `${ DUST_FRONT_API } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
1118
+ `${ apiConfig . getDustFrontAPIUrl ( ) } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
1124
1119
`/data_sources/${ dataSourceConfig . dataSourceId } /tables/${ tableId } ` ;
1125
1120
const dustRequestConfig : AxiosRequestConfig = {
1126
1121
headers : {
@@ -1202,7 +1197,7 @@ export async function _getDataSourceFolder({
1202
1197
} ) ;
1203
1198
1204
1199
const endpoint =
1205
- `${ DUST_FRONT_API } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
1200
+ `${ apiConfig . getDustFrontAPIUrl ( ) } /api/v1/w/${ dataSourceConfig . workspaceId } ` +
1206
1201
`/data_sources/${ dataSourceConfig . dataSourceId } /folders/${ folderId } ` ;
1207
1202
const dustRequestConfig : AxiosRequestConfig = {
1208
1203
headers : {
0 commit comments