/**
 * 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.
 *
 * Product-agnostic: uses LYSNR_SECRETS mapping which points to the
 * shared Key Vault (kv-mywisprai) used by all ByteLyst products.
 */

export async function register() {
  if (process.env.NEXT_RUNTIME === 'nodejs') {
    const { resolveSecrets, LYSNR_SECRETS } = await import('@bytelyst/config');
    await resolveSecrets([LYSNR_SECRETS.JWT_SECRET]);
  }
}
