From f0f5567b6918fc60c8cab15e13aec03a89a91dfb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 16 Mar 2016 22:29:27 +0100 Subject: Use const/let now we use node 4.2 --- server/initializers/checker.js | 20 ++++++++++---------- server/initializers/constants.js | 10 +++++----- server/initializers/database.js | 14 +++++++------- 3 files changed, 22 insertions(+), 22 deletions(-) (limited to 'server/initializers') diff --git a/server/initializers/checker.js b/server/initializers/checker.js index 44d9ea85b..a21e54982 100644 --- a/server/initializers/checker.js +++ b/server/initializers/checker.js @@ -1,24 +1,24 @@ 'use strict' -var config = require('config') -var mkdirp = require('mkdirp') -var path = require('path') +const config = require('config') +const mkdirp = require('mkdirp') +const path = require('path') -var checker = { +const checker = { checkConfig: checkConfig, createDirectoriesIfNotExist: createDirectoriesIfNotExist } // Check the config files function checkConfig () { - var required = [ 'listen.port', + const required = [ 'listen.port', 'webserver.https', 'webserver.host', 'webserver.port', 'database.host', 'database.port', 'database.suffix', 'storage.certs', 'storage.uploads', 'storage.logs', 'network.friends' ] - var miss = [] + const miss = [] - for (var key of required) { + for (const key of required) { if (!config.has(key)) { miss.push(key) } @@ -29,10 +29,10 @@ function checkConfig () { // Create directories for the storage if it doesn't exist function createDirectoriesIfNotExist () { - var storages = config.get('storage') + const storages = config.get('storage') - for (var key of Object.keys(storages)) { - var dir = storages[key] + for (const key of Object.keys(storages)) { + const dir = storages[key] try { mkdirp.sync(path.join(__dirname, '..', '..', dir)) } catch (error) { diff --git a/server/initializers/constants.js b/server/initializers/constants.js index 16e50443b..dc08805b9 100644 --- a/server/initializers/constants.js +++ b/server/initializers/constants.js @@ -1,22 +1,22 @@ 'use strict' // API version of our pod -var API_VERSION = 'v1' +const API_VERSION = 'v1' // Score a pod has when we create it as a friend -var FRIEND_BASE_SCORE = 100 +let FRIEND_BASE_SCORE = 100 // Time to wait between requests to the friends -var INTERVAL = 60000 +let INTERVAL = 60000 // Number of points we add/remove from a friend after a successful/bad request -var PODS_SCORE = { +const PODS_SCORE = { MALUS: -10, BONUS: 10 } // Number of retries we make for the make retry requests (to friends...) -var REQUEST_RETRIES = 10 +let REQUEST_RETRIES = 10 // Special constants for a test instance if (isTestInstance() === true) { diff --git a/server/initializers/database.js b/server/initializers/database.js index a917442ec..830cc7dd8 100644 --- a/server/initializers/database.js +++ b/server/initializers/database.js @@ -1,15 +1,15 @@ 'use strict' -var config = require('config') -var mongoose = require('mongoose') +const config = require('config') +const mongoose = require('mongoose') -var logger = require('../helpers/logger') +const logger = require('../helpers/logger') -var dbname = 'peertube' + config.get('database.suffix') -var host = config.get('database.host') -var port = config.get('database.port') +const dbname = 'peertube' + config.get('database.suffix') +const host = config.get('database.host') +const port = config.get('database.port') -var database = { +const database = { connect: connect } -- cgit v1.2.3