Skip to content

Commit

Permalink
chore: remove password generation as part of nuxt-auth-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Feb 23, 2024
1 parent 32d5e0d commit 9619c6e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion playground/.env.example

This file was deleted.

12 changes: 0 additions & 12 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -158,17 +157,6 @@ export default defineNuxtModule<ModuleOptions>({
// 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')
}
}
}
})

Expand Down

0 comments on commit 9619c6e

Please sign in to comment.