diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-11-01 19:22:39 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-11-01 19:22:39 +0100 |
commit | a2647f7ac6caf1cb93483a1bad54c648b630c2ee (patch) | |
tree | 3e7b3da81abdbefe22e835b64a86d1345cb527e3 /server.js | |
parent | d16b5172ae95f2389084ba2a301088358605771f (diff) | |
download | PeerTube-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.js | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -17,7 +17,6 @@ process.title = 'peertube' | |||
17 | const app = express() | 17 | const app = express() |
18 | 18 | ||
19 | // ----------- Database ----------- | 19 | // ----------- Database ----------- |
20 | const config = require('config') | ||
21 | const constants = require('./server/initializers/constants') | 20 | const constants = require('./server/initializers/constants') |
22 | const database = require('./server/initializers/database') | 21 | const database = require('./server/initializers/database') |
23 | const logger = require('./server/helpers/logger') | 22 | const 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 | ||
76 | const torrentsPhysicalPath = path.join(__dirname, config.get('storage.torrents')) | 75 | const torrentsPhysicalPath = path.join(__dirname, constants.CONFIG.STORAGE.TORRENTS_DIR) |
77 | app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) | 76 | app.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 |
80 | const videosPhysicalPath = path.join(__dirname, config.get('storage.videos')) | 79 | const videosPhysicalPath = path.join(__dirname, constants.CONFIG.STORAGE.VIDEOS_DIR) |
81 | app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) | 80 | app.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 |
84 | const thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails')) | 83 | const thumbnailsPhysicalPath = path.join(__dirname, constants.CONFIG.STORAGE.THUMBNAILS_DIR) |
85 | app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) | 84 | app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) |
86 | 85 | ||
87 | // Client application | 86 | // Client application |