text: const dotenv = require('dotenv');
  const path = require('path');
  const Joi = require('joi');
  
  dotenv.config({ path: path.join(__dirname, `../../.env`) });
  
  const envVarsSchema = Joi.object()
    .keys({
      NODE_ENV: Joi.string().valid('production', 'development', 'test').required(),
      PORT: Joi.number().default(3000),
      MONGODB_URL: Joi.string().default('mongodb://root:123456@127.0.0.1:27017/getir-test'),
    })
    .unknown();
  
  const { value: envVars, error } = envVarsSchema.prefs({ errors: { label: 'key' } }).validate(process.env);
  
  if (error) {
    throw new Error(`Config validation error: ${error.message}`);
  }
  
  module.exports = {
    env: envVars.NODE_ENV,
    port: envVars.PORT,
    mongoose: {
      url: envVars.MONGODB_URL,
      options: {
        useCreateIndex: true,
        useNewUrlParser: true,
        useUnifiedTopology: true,
      },
    },
  };
  