|
17 | 17 |
|
18 | 18 | import { mixins, pino } from '@oada/pino-debug'; |
19 | 19 |
|
| 20 | +import { config } from './config.js'; |
| 21 | + |
20 | 22 | import { KafkaError } from '@oada/lib-kafka'; |
21 | 23 | import { nstats } from '@oada/lib-prom'; |
22 | 24 |
|
23 | 25 | import { plugin as formats } from '@oada/formats-server'; |
24 | 26 |
|
25 | 27 | import tokenLookup, { TokenResponse } from './tokenLookup.js'; |
26 | 28 | import authorizations from './authorizations.js'; |
27 | | -import { config } from './config.js'; |
28 | 29 | import resources from './resources.js'; |
29 | 30 | import users from './users.js'; |
30 | 31 | import websockets from './websockets.js'; |
@@ -86,8 +87,10 @@ mixins.push(() => ({ |
86 | 87 | reqId: requestContext.get('id'), |
87 | 88 | })); |
88 | 89 |
|
| 90 | +const trustProxy = config.get('trustProxy'); |
89 | 91 | // eslint-disable-next-line new-cap |
90 | 92 | export const fastify = Fastify({ |
| 93 | + trustProxy, |
91 | 94 | logger: { |
92 | 95 | ...logger, |
93 | 96 | // HACK: fastify overrides existing serializers. This circumvents that... |
@@ -137,12 +140,13 @@ if (process.env.NODE_ENV !== 'production') { |
137 | 140 | }); |
138 | 141 | } |
139 | 142 |
|
| 143 | +const port = config.get('server.port'); |
140 | 144 | export async function start(): Promise<void> { |
141 | 145 | await fastify.listen({ |
142 | | - port: config.get('server.port'), |
| 146 | + port, |
143 | 147 | host: '::', |
144 | 148 | }); |
145 | | - fastify.log.info('OADA Server started on port %d', config.get('server.port')); |
| 149 | + fastify.log.info('OADA Server started on port %d', port); |
146 | 150 | } |
147 | 151 |
|
148 | 152 | declare module '@fastify/request-context' { |
|
0 commit comments