diff --git a/.env.development b/.env.development index 82aa71d..7398df1 100644 --- a/.env.development +++ b/.env.development @@ -1,7 +1,12 @@ NODE_TLS_REJECT_UNAUTHORIZED=0 # NODE_EXTRA_CA_CERTS=C:\\Users\\popov\\AppData\\Local\\mkcert + +NEXT_PUBLIC_PROTOCOL=http +NEXT_PUBLIC_HOST=localhost +NEXT_PUBLIC_PORT=3003 +NEXTAUTH_URL=http://localhost:3003 + SSL_ENABLED=true -NEXT_PUBLIC_PORT=3004 SSL_KEY=./certificates/localhost-key.pem SSL_CERT=./certificates/localhost.pem diff --git a/.gitignore b/.gitignore index 475b0a2..670be0a 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ next-cart-app.zip !public/uploads/thumb/ certificates content/output/* +baseUrl.txt diff --git a/server.js b/server.js index 2a0aa66..49a1969 100644 --- a/server.js +++ b/server.js @@ -79,14 +79,14 @@ app } next(); }); - } - if (process.env.SSL_KEY && process.env.SSL_CERT) { - const options = { - key: fs.readFileSync(process.env.SSL_KEY), - cert: fs.readFileSync(process.env.SSL_CERT), - secureProtocol: 'TLSv1_2_method', // Example: Force TLS 1.2 - }; - https.createServer(options, server).listen(PORT); + if (process.env.SSL_KEY && process.env.SSL_CERT) { + const options = { + key: fs.readFileSync(process.env.SSL_KEY), + cert: fs.readFileSync(process.env.SSL_CERT), + secureProtocol: 'TLSv1_2_method', // Example: Force TLS 1.2 + }; + https.createServer(options, server).listen(PORT); + } } // Add the middleware to set 'x-forwarded-host' header diff --git a/src/helpers/common.js b/src/helpers/common.js index 3960ad4..57a189f 100644 --- a/src/helpers/common.js +++ b/src/helpers/common.js @@ -118,7 +118,7 @@ exports.getPrismaClient = function getPrismaClient() { logger.debug("getPrismaClient: process.env.DATABASE_URL = ", process.env.DATABASE_URL); prisma = new PrismaClient({ // Optional: Enable logging - // log: ['query', 'info', 'warn', 'error'], + log: ['query', 'info', 'warn', 'error'], datasources: { db: { url: process.env.DATABASE_URL } }, }); } diff --git a/src/helpers/data.js b/src/helpers/data.js index 083bb78..187ee30 100644 --- a/src/helpers/data.js +++ b/src/helpers/data.js @@ -66,7 +66,7 @@ async function findPublisher(names, email, select, getAll = false) { if (result.length === 0 && names) { console.log("No publisher found, trying fuzzy search for '" + names + "'- email: '" + email + "'"); const publishers = await prisma.publisher.findMany(); - result = await common.fuzzySearch(publishers, names, 0.90); + result = [await common.fuzzySearch(publishers, names, 0.90)]; console.log("Fuzzy search result: " + result?.firstName + " " + result?.lastName + " - " + result?.email); } //always return an array