JavaScript
node-cooper-fastify
A Fastify plugin that loads an application’s CASC configuration once, at startup, puts it on fastify.config, and gives the server its own options from the same document.
Intention
Fastify has no configuration system of its own, so this takes the place of @fastify/env and dotenv rather than sitting beside them. The loading and reading are cooper-config’s, so fastify.config and the plain library read one configuration. A document that does not load means the server never starts.
Example
import Fastify from 'fastify';
import cooper, { serverOptions, listenOptions } from '@joetjen/cooper-fastify';
const app = Fastify(await serverOptions()); // loads config/config.casc, once
await app.register(cooper); // fastify.config
app.get('/db', async (request) => ({ host: request.server.config.get('db.host') }));
await app.listen(listenOptions());Install
npm install @joetjen/cooper-fastify