Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
settings: add CSV_STORAGE_SIZE
Browse files Browse the repository at this point in the history
* Added setting CSV_STORAGE_SIZE to limit the size of the CSV storage.
  • Loading branch information
n-riesco committed Feb 21, 2018
1 parent 9b39565 commit 9c24a81
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 10 additions & 1 deletion backend/routes.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions backend/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 9c24a81

Please sign in to comment.