Fixed missing variables

This commit is contained in:
2024-03-03 10:45:24 +00:00
parent ecea682fdd
commit 5cc67b27bc
13 changed files with 179 additions and 62 deletions

19
handler/index.js Normal file → Executable file
View File

@ -14,24 +14,24 @@ const cwd = process.cwd()
module.exports = async (client) => {
const uri = `mongodb+srv://${process.env.MONGODBUSER}:${process.env.MONGODBPASS}@${process.env.MONGODBCLUSTER}/${process.env.DATABASE}?retryWrites=true&w=majority`
const dblocation = process.env.DBLOCATION
if (dblocation === 'selfhosted') {
await mongoose.connect('mongodb://localhost:27017/wolfcounter', {
const uri = `mongodb://${process.env.MONGODBUSER}:${process.env.MONGODBPASS}@${process.env.MONGODBHOST}/${process.env.DATABASE}`
mongoose.connect(`${uri}`, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => {
console.log('');
console.log(`Connected to the selfhosted database`);
}).catch((error) => {
console.log(`Failed to connect to the selfhosted database`);
console.log(`Failed to connect to the database`);
console.log(error);
});
} else if (dblocation === 'cloud') {
await mongoose.connect(`mongodb+srv://${process.env.MONGODBUSER}:${process.env.MONGODBPASS}@${process.env.MONGODBCLUSTER}/${process.env.DATABASE}?retryWrites=true&w=majority`, {
} else if (dblocation === 'cloud') {
const uri = `mongodb+srv://${process.env.MONGODBUSER}:${process.env.MONGODBPASS}@${process.env.MONGODBCLUSTER}/${process.env.DATABASE}?retryWrites=true&w=majority`
await mongoose.connect(`${uri}`, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => {
@ -155,6 +155,9 @@ module.exports = async (client) => {
res.render('tos');
});
app.get("/donate", (req, res) => {
res.render('donate');
});
// redirect /invite to the discord invite
app.get('/invite', async (req, res) => {