aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-09-05 09:43:35 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-09-05 10:17:02 +0200
commitbe04c6fdab5d91a7a57fa3ff36cde22a549c29da (patch)
treeb273cfb4cf3d0b73b12a1b9bb25884851255fc7e /server
parent592c735c19b25e9b38f82d90d15a81307902ed62 (diff)
downloadPeerTube-be04c6fdab5d91a7a57fa3ff36cde22a549c29da.tar.gz
PeerTube-be04c6fdab5d91a7a57fa3ff36cde22a549c29da.tar.zst
PeerTube-be04c6fdab5d91a7a57fa3ff36cde22a549c29da.zip
Add hardware information in instance config
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/config.ts3
-rw-r--r--server/initializers/config.ts1
-rw-r--r--server/tests/api/check-params/config.ts1
-rw-r--r--server/tests/api/server/config.ts14
4 files changed, 19 insertions, 0 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 909907ad6..39a124fc5 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -161,6 +161,8 @@ function getAbout (req: express.Request, res: express.Response) {
161 terms: CONFIG.INSTANCE.TERMS, 161 terms: CONFIG.INSTANCE.TERMS,
162 codeOfConduct: CONFIG.INSTANCE.CODE_OF_CONDUCT, 162 codeOfConduct: CONFIG.INSTANCE.CODE_OF_CONDUCT,
163 163
164 hardwareInformation: CONFIG.INSTANCE.HARDWARE_INFORMATION,
165
164 creationReason: CONFIG.INSTANCE.CREATION_REASON, 166 creationReason: CONFIG.INSTANCE.CREATION_REASON,
165 moderationInformation: CONFIG.INSTANCE.MODERATION_INFORMATION, 167 moderationInformation: CONFIG.INSTANCE.MODERATION_INFORMATION,
166 administrator: CONFIG.INSTANCE.ADMINISTRATOR, 168 administrator: CONFIG.INSTANCE.ADMINISTRATOR,
@@ -238,6 +240,7 @@ function customConfig (): CustomConfig {
238 administrator: CONFIG.INSTANCE.ADMINISTRATOR, 240 administrator: CONFIG.INSTANCE.ADMINISTRATOR,
239 maintenanceLifetime: CONFIG.INSTANCE.MAINTENANCE_LIFETIME, 241 maintenanceLifetime: CONFIG.INSTANCE.MAINTENANCE_LIFETIME,
240 businessModel: CONFIG.INSTANCE.BUSINESS_MODEL, 242 businessModel: CONFIG.INSTANCE.BUSINESS_MODEL,
243 hardwareInformation: CONFIG.INSTANCE.HARDWARE_INFORMATION,
241 244
242 languages: CONFIG.INSTANCE.LANGUAGES, 245 languages: CONFIG.INSTANCE.LANGUAGES,
243 categories: CONFIG.INSTANCE.CATEGORIES, 246 categories: CONFIG.INSTANCE.CATEGORIES,
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 8df411ca5..164d714d6 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -217,6 +217,7 @@ const CONFIG = {
217 get ADMINISTRATOR () { return config.get<string>('instance.administrator') }, 217 get ADMINISTRATOR () { return config.get<string>('instance.administrator') },
218 get MAINTENANCE_LIFETIME () { return config.get<string>('instance.maintenance_lifetime') }, 218 get MAINTENANCE_LIFETIME () { return config.get<string>('instance.maintenance_lifetime') },
219 get BUSINESS_MODEL () { return config.get<string>('instance.business_model') }, 219 get BUSINESS_MODEL () { return config.get<string>('instance.business_model') },
220 get HARDWARE_INFORMATION () { return config.get<string>('instance.hardware_information') },
220 221
221 get LANGUAGES () { return config.get<string[]>('instance.languages') || [] }, 222 get LANGUAGES () { return config.get<string[]>('instance.languages') || [] },
222 get CATEGORIES () { return config.get<number[]>('instance.categories') || [] }, 223 get CATEGORIES () { return config.get<number[]>('instance.categories') || [] },
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index 9b902a1cd..9435bb1e8 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -34,6 +34,7 @@ describe('Test config API validators', function () {
34 administrator: 'Kuja', 34 administrator: 'Kuja',
35 maintenanceLifetime: 'forever', 35 maintenanceLifetime: 'forever',
36 businessModel: 'my super business model', 36 businessModel: 'my super business model',
37 hardwareInformation: '2vCore 3GB RAM',
37 38
38 languages: [ 'en', 'es' ], 39 languages: [ 'en', 'es' ],
39 categories: [ 1, 2 ], 40 categories: [ 1, 2 ],
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index 85d0f9702..97cc99eea 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -36,6 +36,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
36 expect(data.instance.administrator).to.be.empty 36 expect(data.instance.administrator).to.be.empty
37 expect(data.instance.maintenanceLifetime).to.be.empty 37 expect(data.instance.maintenanceLifetime).to.be.empty
38 expect(data.instance.businessModel).to.be.empty 38 expect(data.instance.businessModel).to.be.empty
39 expect(data.instance.hardwareInformation).to.be.empty
39 40
40 expect(data.instance.languages).to.have.lengthOf(0) 41 expect(data.instance.languages).to.have.lengthOf(0)
41 expect(data.instance.categories).to.have.lengthOf(0) 42 expect(data.instance.categories).to.have.lengthOf(0)
@@ -97,6 +98,7 @@ function checkUpdatedConfig (data: CustomConfig) {
97 expect(data.instance.administrator).to.equal('Kuja') 98 expect(data.instance.administrator).to.equal('Kuja')
98 expect(data.instance.maintenanceLifetime).to.equal('forever') 99 expect(data.instance.maintenanceLifetime).to.equal('forever')
99 expect(data.instance.businessModel).to.equal('my super business model') 100 expect(data.instance.businessModel).to.equal('my super business model')
101 expect(data.instance.hardwareInformation).to.equal('2vCore 3GB RAM')
100 102
101 expect(data.instance.languages).to.deep.equal([ 'en', 'es' ]) 103 expect(data.instance.languages).to.deep.equal([ 'en', 'es' ])
102 expect(data.instance.categories).to.deep.equal([ 1, 2 ]) 104 expect(data.instance.categories).to.deep.equal([ 1, 2 ])
@@ -219,6 +221,7 @@ describe('Test config', function () {
219 administrator: 'Kuja', 221 administrator: 'Kuja',
220 maintenanceLifetime: 'forever', 222 maintenanceLifetime: 'forever',
221 businessModel: 'my super business model', 223 businessModel: 'my super business model',
224 hardwareInformation: '2vCore 3GB RAM',
222 225
223 languages: [ 'en', 'es' ], 226 languages: [ 'en', 'es' ],
224 categories: [ 1, 2 ], 227 categories: [ 1, 2 ],
@@ -362,6 +365,17 @@ describe('Test config', function () {
362 expect(data.instance.shortDescription).to.equal('my short description') 365 expect(data.instance.shortDescription).to.equal('my short description')
363 expect(data.instance.description).to.equal('my super description') 366 expect(data.instance.description).to.equal('my super description')
364 expect(data.instance.terms).to.equal('my super terms') 367 expect(data.instance.terms).to.equal('my super terms')
368 expect(data.instance.codeOfConduct).to.equal('my super coc')
369
370 expect(data.instance.creationReason).to.equal('my super creation reason')
371 expect(data.instance.moderationInformation).to.equal('my super moderation information')
372 expect(data.instance.administrator).to.equal('Kuja')
373 expect(data.instance.maintenanceLifetime).to.equal('forever')
374 expect(data.instance.businessModel).to.equal('my super business model')
375 expect(data.instance.hardwareInformation).to.equal('2vCore 3GB RAM')
376
377 expect(data.instance.languages).to.deep.equal([ 'en', 'es' ])
378 expect(data.instance.categories).to.deep.equal([ 1, 2 ])
365 }) 379 })
366 380
367 it('Should remove the custom configuration', async function () { 381 it('Should remove the custom configuration', async function () {