aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-01 19:22:39 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-01 19:22:39 +0100
commita2647f7ac6caf1cb93483a1bad54c648b630c2ee (patch)
tree3e7b3da81abdbefe22e835b64a86d1345cb527e3 /server.js
parentd16b5172ae95f2389084ba2a301088358605771f (diff)
downloadPeerTube-a2647f7ac6caf1cb93483a1bad54c648b630c2ee.tar.gz
PeerTube-a2647f7ac6caf1cb93483a1bad54c648b630c2ee.tar.zst
PeerTube-a2647f7ac6caf1cb93483a1bad54c648b630c2ee.zip
Server: use constants for static paths too
Diffstat (limited to 'server.js')
-rw-r--r--server.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/server.js b/server.js
index b29fba633..e5bb5d1a4 100644
--- a/server.js
+++ b/server.js
@@ -17,7 +17,6 @@ process.title = 'peertube'
17const app = express() 17const app = express()
18 18
19// ----------- Database ----------- 19// ----------- Database -----------
20const config = require('config')
21const constants = require('./server/initializers/constants') 20const constants = require('./server/initializers/constants')
22const database = require('./server/initializers/database') 21const database = require('./server/initializers/database')
23const logger = require('./server/helpers/logger') 22const logger = require('./server/helpers/logger')
@@ -73,15 +72,15 @@ app.use('/client/*', function (req, res, next) {
73 res.sendStatus(404) 72 res.sendStatus(404)
74}) 73})
75 74
76const torrentsPhysicalPath = path.join(__dirname, config.get('storage.torrents')) 75const torrentsPhysicalPath = path.join(__dirname, constants.CONFIG.STORAGE.TORRENTS_DIR)
77app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) 76app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE }))
78 77
79// Videos path for webseeding 78// Videos path for webseeding
80const videosPhysicalPath = path.join(__dirname, config.get('storage.videos')) 79const videosPhysicalPath = path.join(__dirname, constants.CONFIG.STORAGE.VIDEOS_DIR)
81app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) 80app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPath, { maxAge: constants.STATIC_MAX_AGE }))
82 81
83// Thumbnails path for express 82// Thumbnails path for express
84const thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails')) 83const thumbnailsPhysicalPath = path.join(__dirname, constants.CONFIG.STORAGE.THUMBNAILS_DIR)
85app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) 84app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE }))
86 85
87// Client application 86// Client application