/**
 * Next.js instrumentation hook — runs once at server startup.
 * Resolves secrets from configured provider into process.env BEFORE
 * any route handlers or Cosmos client initialization.
 */

import { resolveSecrets, LYSNR_SECRETS } from '@bytelyst/config/keyvault';

export async function register() {
  if (process.env.NEXT_RUNTIME === 'nodejs') {
    await resolveSecrets([
      LYSNR_SECRETS.COSMOS_KEY,
      LYSNR_SECRETS.COSMOS_ENDPOINT,
      LYSNR_SECRETS.JWT_SECRET,
      LYSNR_SECRETS.SEED_SECRET,
      LYSNR_SECRETS.STRIPE_SECRET_KEY,
    ]);
  }
}
