We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to disable Fastify logger in production mode using fastify-env, but I'm not able to collect NODE_ENV from process.env when using fastify-env.
import fastify from 'fastify'; import fastifyEnv from 'fastify-env'; declare module 'fastify' { interface FastifyInstance { config: { NODE_ENV: string; }; } } const app = fastify({ logger: process.env.NODE_ENV === 'development' ? { prettyPrint: { levelFirst: true, translateTime: 'HH:MM:ss Z', ignore: 'pid,hostname', }, } : false, }); const start = async () => { try { await app.register(fastifyEnv, { dotenv: true, confKey: 'config', schema: { type: 'object', properties: { NODE_ENV: { type: 'string', enum: ['development', 'production'], }, }, required: ['NODE_ENV'], }, }); await app.ready(); await app.listen(3000); } catch (error) { app.log.error(error); process.exit(1); } }; start();
The text was updated successfully, but these errors were encountered:
It is impossible to get something before it is actually initialized. Please use env-schema for sync loading of env.
env-schema
Sorry, something went wrong.
Thanks
No branches or pull requests
Prerequisites
Issue
I want to disable Fastify logger in production mode using fastify-env, but I'm not able to collect NODE_ENV from process.env when using fastify-env.
The text was updated successfully, but these errors were encountered: