From 9619c6e0ce1cf1eef8f0b42229444510808eefb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 23 Feb 2024 11:48:35 +0100 Subject: [PATCH] chore: remove password generation as part of nuxt-auth-utils --- playground/.env.example | 1 - src/module.ts | 12 ------------ 2 files changed, 13 deletions(-) delete mode 100644 playground/.env.example diff --git a/playground/.env.example b/playground/.env.example deleted file mode 100644 index abfe815e..00000000 --- a/playground/.env.example +++ /dev/null @@ -1 +0,0 @@ -NUXT_SESSION_PASSWORD= diff --git a/src/module.ts b/src/module.ts index 914de7ab..aecb0e18 100644 --- a/src/module.ts +++ b/src/module.ts @@ -1,7 +1,6 @@ import { defineNuxtModule, createResolver, logger, addServerScanDir } from '@nuxt/kit' import { join } from 'pathe' import { defu } from 'defu' -import { randomUUID } from 'uncrypto' import { mkdir, writeFile, readFile } from 'node:fs/promises' import { findWorkspaceDir } from 'pkg-types' import { readUser } from 'rc9' @@ -158,17 +157,6 @@ export default defineNuxtModule({ // Add server plugin nuxt.options.nitro.plugins = nuxt.options.nitro.plugins || [] nuxt.options.nitro.plugins.push(resolve('./runtime/server/plugins/cloudflare.dev')) - - // Generate the session password - if (!process.env.NUXT_SESSION_PASSWORD) { - process.env.NUXT_SESSION_PASSWORD = randomUUID().replace(/-/g, '') - // Add it to .env - const envPath = join(rootDir, '.env') - const envContent = await readFile(envPath, 'utf-8').catch(() => '') - if (!envContent.includes('NUXT_SESSION_PASSWORD')) { - await writeFile(envPath, `${envContent ? envContent + '\n' : envContent}NUXT_SESSION_PASSWORD=${process.env.NUXT_SESSION_PASSWORD}`, 'utf-8') - } - } } })