aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/constants.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-19 21:34:51 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-19 21:34:51 +0200
commite861452fb26553177ad4e32bfb18b4fd8a5b1816 (patch)
tree7c0cfd464709243a452b431665f5107a973df682 /server/initializers/constants.js
parent5c39adb7313e0696aabb4b71196ab7b0b378c359 (diff)
downloadPeerTube-e861452fb26553177ad4e32bfb18b4fd8a5b1816.tar.gz
PeerTube-e861452fb26553177ad4e32bfb18b4fd8a5b1816.tar.zst
PeerTube-e861452fb26553177ad4e32bfb18b4fd8a5b1816.zip
Server: put config in constants
Diffstat (limited to 'server/initializers/constants.js')
-rw-r--r--server/initializers/constants.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index cd2e0cfb9..ce9f8ad6c 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -1,8 +1,34 @@
1'use strict' 1'use strict'
2 2
3const config = require('config')
4const path = require('path')
5
3// API version of our pod 6// API version of our pod
4const API_VERSION = 'v1' 7const API_VERSION = 'v1'
5 8
9const CONFIG = {
10 DATABASE: {
11 DBNAME: 'peertube' + config.get('database.suffix'),
12 HOST: config.get('database.host'),
13 PORT: config.get('database.port')
14 },
15 ELECTRON: {
16 DEBUG: config.get('electron.debug')
17 },
18 STORAGE: {
19 CERT_DIR: path.join(__dirname, '..', '..', config.get('storage.certs')),
20 LOG_DIR: path.join(__dirname, '..', '..', config.get('storage.logs')),
21 UPLOAD_DIR: path.join(__dirname, '..', '..', config.get('storage.uploads')),
22 THUMBNAILS_DIR: path.join(__dirname, '..', '..', config.get('storage.thumbnails'))
23 },
24 WEBSERVER: {
25 SCHEME: config.get('webserver.https') === true ? 'https' : 'http',
26 HOST: config.get('webserver.host'),
27 PORT: config.get('webserver.port')
28 }
29}
30CONFIG.WEBSERVER.URL = CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOST + ':' + CONFIG.WEBSERVER.PORT
31
6const CONSTRAINTS_FIELDS = { 32const CONSTRAINTS_FIELDS = {
7 USERS: { 33 USERS: {
8 USERNAME: { min: 3, max: 20 }, // Length 34 USERNAME: { min: 3, max: 20 }, // Length
@@ -89,6 +115,7 @@ if (isTestInstance() === true) {
89 115
90module.exports = { 116module.exports = {
91 API_VERSION: API_VERSION, 117 API_VERSION: API_VERSION,
118 CONFIG: CONFIG,
92 CONSTRAINTS_FIELDS: CONSTRAINTS_FIELDS, 119 CONSTRAINTS_FIELDS: CONSTRAINTS_FIELDS,
93 FRIEND_SCORE: FRIEND_SCORE, 120 FRIEND_SCORE: FRIEND_SCORE,
94 INTERVAL: INTERVAL, 121 INTERVAL: INTERVAL,