admin:
email: 'admin@example.com'
+
+signup:
+ enabled: false
admin:
email: 'admin@example.com'
+
+signup:
+ enabled: false
database:
hostname: 'localhost'
port: 5432
+
+signup:
+ enabled: true
--- /dev/null
+'use strict'
+
+const express = require('express')
+
+const constants = require('../../initializers/constants')
+
+const router = express.Router()
+
+router.get('/', getConfig)
+
+// Get the client credentials for the PeerTube front end
+function getConfig (req, res, next) {
+ res.json({
+ signup: {
+ enabled: constants.CONFIG.SIGNUP.ENABLED
+ }
+ })
+}
+
+// ---------------------------------------------------------------------------
+
+module.exports = router
const router = express.Router()
const clientsController = require('./clients')
+const configController = require('./config')
const podsController = require('./pods')
const remoteController = require('./remote')
const requestsController = require('./requests')
const videosController = require('./videos')
router.use('/clients', clientsController)
+router.use('/config', configController)
router.use('/pods', podsController)
router.use('/remote', remoteController)
router.use('/requests', requestsController)
'webserver.https', 'webserver.hostname', 'webserver.port',
'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password',
'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews',
- 'admin.email'
+ 'admin.email', 'signup.enabled'
]
const miss = []
},
ADMIN: {
EMAIL: config.get('admin.email')
+ },
+ SIGNUP: {
+ ENABLED: config.get('signup.enabled')
}
}
CONFIG.WEBSERVER.URL = CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
--- /dev/null
+/* eslint-disable no-unused-expressions */
+
+'use strict'
+
+const chai = require('chai')
+const expect = chai.expect
+const series = require('async/series')
+
+const serversUtils = require('../utils/servers')
+const configUtils = require('../utils/config')
+
+describe('Test config', function () {
+ let server = null
+
+ before(function (done) {
+ this.timeout(20000)
+
+ series([
+ function (next) {
+ serversUtils.flushTests(next)
+ },
+ function (next) {
+ serversUtils.runServer(1, function (server1) {
+ server = server1
+ next()
+ })
+ }
+ ], done)
+ })
+
+ it('Should have a correct config', function (done) {
+ configUtils.getConfig(server.url, function (err, res) {
+ if (err) throw err
+
+ const data = res.body
+
+ expect(data.signup.enabled).to.be.truthy
+
+ done()
+ })
+ })
+
+ after(function (done) {
+ process.kill(-server.app.pid)
+
+ // Keep the logs if the test failed
+ if (this.ok) {
+ serversUtils.flushTests(done)
+ } else {
+ done()
+ }
+ })
+})
'use strict'
// Order of the tests we want to execute
+require('./config')
require('./check-params')
require('./friends-basic')
require('./users')
--- /dev/null
+'use strict'
+
+const request = require('supertest')
+
+const configsUtils = {
+ getConfig
+}
+
+// ---------------------- Export functions --------------------
+
+function getConfig (url, end) {
+ const path = '/api/v1/config'
+
+ request(url)
+ .get(path)
+ .set('Accept', 'application/json')
+ .expect(200)
+ .expect('Content-Type', /json/)
+ .end(end)
+}
+
+// ---------------------------------------------------------------------------
+
+module.exports = configsUtils