-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathapp.js
More file actions
52 lines (51 loc) · 1.57 KB
/
Copy pathapp.js
File metadata and controls
52 lines (51 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import config from 'config'
import { getHunspellAvailableLangs } from '../../csaf-validator-lib/hunspell.js'
/**
* @param {import('fastify').FastifyInstance} fastify
*/
export default async function (fastify) {
fastify.register(import('@fastify/swagger'), {
routePrefix: '/docs',
openapi: {
info: {
title: 'CSAF Validator Service',
version: '1.3.46',
description:
'This is a service to validate documents against the CSAF standard.',
contact: {
url: 'https://github.com/secvisogram/csaf-validator-service',
email: 'secvisogram@bsi.bund.de',
},
license: {
name: 'MIT',
url: 'https://github.com/secvisogram/csaf-validator-service/blob/main/LICENSE',
},
},
},
hideUntagged: false,
exposeRoute: true,
})
fastify.register(import('./app/getTests.js'))
fastify.register(import('./app/validate.js'))
getHunspellAvailableLangs().then(
(availableLangs) => {
fastify.log.info(
'Installation of hunspell found! Available languages: ' +
availableLangs.join(', ')
)
},
() => {
fastify.log.warn(
'No installation of hunspell found, test 6.3.8 is not available!'
)
}
)
fastify.register(import('@fastify/cors'), {
origin: config.get('cors')?.origin,
methods: config.get('cors')?.methods,
allowedHeaders: config.get('cors')?.allowedHeaders,
exposedHeaders: config.get('cors')?.exposedHeaders,
credentials: config.get('cors')?.credentials,
maxAge: config.get('cors')?.maxAge,
})
}