Skip to content

Commit

Permalink
trying fix error to build and deploy on github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Juanestban committed Jan 24, 2024
1 parent b3d1343 commit 000763b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
7 changes: 5 additions & 2 deletions config/mongoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ const mongoose = require('mongoose');
const { MONGODB_ATLAS_USERNAME, MONGODB_ATLAS_PASSWORD, NODE_ENV } = process.env;
const database = NODE_ENV === 'production' ? 'notipadDB' : 'notipadDB_development';
const urlMongo = `mongodb+srv://${MONGODB_ATLAS_USERNAME}:${MONGODB_ATLAS_PASSWORD}@lilith-notipad.qzy3ydb.mongodb.net/${database}?retryWrites=true&w=majority`;
mongoose

const connect = () => {
mongoose
.connect(urlMongo, {
useNewUrlParser: true,
useUnifiedTopology: true,
})
.then(() => console.log('mongodb is connected'))
.catch((error) => console.error(`error in connection to database => ${error}`));
}

module.exports = mongoose;
module.exports = connect
10 changes: 5 additions & 5 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const env = require('dotenv');
const connect = require('./config/mongoose');

env.config();
connect();

require('./config/mongoose');

const isProduction = process.env.NODE_ENV === 'production' || process.env.GITHUB_ACTIONS
const basePath = isProduction ? '/lilith-notipad' : '/'
const assetPrefix = isProduction ? '/lilith-notipad/' : ''
const isProduction = process.env.NODE_ENV === 'production' || process.env.GITHUB_ACTIONS;
const basePath = isProduction ? '/lilith-notipad' : '/';
const assetPrefix = isProduction ? '/lilith-notipad/' : '';

/** @type {import('next').NextConfig} */
const nextConfig = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"eslint-plugin-react": "7.31.7",
"husky": "8.0.1",
"lint-staged": "13.0.3",
"prettier": "2.7.1",
"prettier": "2.8.8",
"typescript": "*"
},
"lint-staged": {
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 000763b

Please sign in to comment.