diff --git a/backend/routes.js b/backend/routes.js index cd0b2d408..6d08cd6ae 100644 --- a/backend/routes.js +++ b/backend/routes.js @@ -1,9 +1,11 @@ var restify = require('restify'); var CookieParser = require('restify-cookies'); -import * as Datastores from './persistent/datastores/Datastores.js'; import * as fs from 'fs'; import path from 'path'; +import * as Datastores from './persistent/datastores/Datastores.js'; +const setSizeCSVStorage = require('./persistent/datastores/csv.js').setSize + import {PlotlyOAuth} from './plugins/authorization.js'; import {getQueries, getQuery, deleteQuery} from './persistent/Queries'; import { @@ -34,6 +36,13 @@ export default class Servers { * The httpsServer starts when certificates have been created. */ constructor(args = {createCerts: true, startHttps: true, isElectron: false}) { + try { + setSizeCSVStorage(getSetting('CSV_STORAGE_SIZE')); + } catch (error) { + Logger.log(`Failed to get setting CSV_STORAGE_SIZE: ${error.message}`); + setSizeCSVStorage(0); + } + this.httpServer = { port: null, server: null, diff --git a/backend/settings.js b/backend/settings.js index cc5756496..55702a442 100644 --- a/backend/settings.js +++ b/backend/settings.js @@ -36,6 +36,11 @@ const DEFAULT_SETTINGS = { */ ADDITIONAL_CORS_ALLOWED_ORIGINS: [], + /* + * Storage size of CSV connector in bytes (0 to disable size limit) + */ + CSV_STORAGE_SIZE: 0, + DEFAULT_CORS_ALLOWED_ORIGINS: [ 'https://plot.ly', 'https://stage.plot.ly',