Skip to content

Commit

Permalink
Merge pull request #99 from HarkerRobo/dev-auth
Browse files Browse the repository at this point in the history
Add dev auth
  • Loading branch information
AdrianR3 authored Dec 7, 2024
2 parents db997ac + 302883b commit 0b3a920
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 4,327 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ The config file should be stored as `config.json`. You can copy from the example
| database.databaseName | "robotics-website" | The name of the database used for this program. |
| automail.singleMentorMail | true | Whether to send the email for purchase requests to a mentor once per day or after every purchase request (set to `true` if only once per day) |
| automail.cronPattern | "0 17 \* \* \*" | The cron pattern for scheduling emails if `automail.singleMentorMail` is true (use the example value to send at 5 P.M. every day). |
| automail.auth.user | "[email protected]" | The email address to send from |
| automail.auth.pass | "password" | The password of the nodemail user
| automail.auth.user | "[email protected]" | The email address to send from |
| automail.auth.pass | "password" | The password of the nodemail user |
| photos.host | "https://photos.harker.org" | The website hosting the photos of students |
| photos.auth | "key" | The API key used to access the photos |
| users.admins | ["[email protected]", "[email protected]", "[email protected]"] | The array of google email addresses of the admins. |
Expand Down
8 changes: 4 additions & 4 deletions helpers/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ var transporter = nodemailer.createTransport({
port: config.automail.auth.port,
secure: config.automail.auth.secure,
auth: {
user: config.automail.auth.username,
pass: config.automail.auth.password
user: config.automail.auth.username,
pass: config.automail.auth.password,
},
tls: { rejectUnauthorized: false }
tls: { rejectUnauthorized: false },
});

const sendMail = (from, to, subject, text, html) => {
Expand All @@ -28,6 +28,6 @@ const sendMail = (from, to, subject, text, html) => {
console.log("Email sent: " + info.response);
}
});
}
};

exports.sendMail = sendMail;
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function getTimeFormatted() {

app.set("view engine", "ejs");
app.set("views", __dirname + "/views");
app.set("env", "production");
app.set("env", config.server.runInternal ? "production" : "development");
app.set("case sensitive routing", true);
if (config.server.production) app.set("trust proxy", 1);

Expand All @@ -55,14 +55,17 @@ app.use(clientErrorHandler);
//TODO: Route mobile

// use routers
if (config.server.runInternal) app.use("/member", memberRouter);
// if (config.server.runInternal)
app.use("/member", memberRouter);

if (config.server.runInternal)
app.use("/scoutdata", require("./routers/scoutdata"));
app.use("/battery", batteryRouter);
app.use("/blog", blogsRouter);

app.locals.GoogleClientID = config.google.clientIDs[config.google.displayID];
app.locals.config = config;
app.locals.isProduction = config.server.runInternal;
app.locals.ranks = require("./helpers/ranks.json");

app.use("/hackathon", hackathonRouter);
Expand Down
Loading

0 comments on commit 0b3a920

Please sign in to comment.