Ported DB-powered key-value pair configuration from Pong repo.
Ported endpoint manager and endpoint implementation from Ping (desktop) and Pong repos.
Implemented test utility mockInternetEndpoint() to make it easy to write endpoint-related tests, and included an example in /src/example.spec.ts.
The most interesting output from this work is the ability to get the connection params, which is to be used in #8:
// Call this from a Fastify onReady hook.
const endpointManager = await InternetEndpointManager.init(request.mongoose);
// Eventually when we define the route...
fastify.route({
method: ['GET'],
url: '/connection-params.der',
async handler(req, reply): Promise<FastifyReply<any>> {
const endpoint = await endpointManager.getActiveEndpoint(); // Probably want to decorate this in `fastify`
return reply.type(CONTENT_TYPES.DER).send(endpoint.getConnectionParams());
},
});
Part of #17.
High-level changes
mockInternetEndpoint()
to make it easy to write endpoint-related tests, and included an example in/src/example.spec.ts
.The most interesting output from this work is the ability to get the connection params, which is to be used in #8: