This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
337 changed files
with
138,926 additions
and
3,585 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,4 +81,4 @@ export class CommunicatorBuilder { | |
this._mspId | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,5 +73,4 @@ export class CommunicatorFactory { | |
.mspId(ORG3_MSP_ID) | ||
.build(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,4 +95,4 @@ class GrpcClientPool { | |
} | ||
} | ||
|
||
export default GrpcClientPool; | ||
export default GrpcClientPool; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,4 +47,3 @@ const acObject: AccessControl = new AccessControl(grantsObject); | |
acObject.lock(); | ||
|
||
export {acObject as ac}; | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import nodemailer from 'nodemailer'; | ||
import fs from "fs"; | ||
|
||
const path = "/run/secrets/google_api_secret"; | ||
const secretValue = fs.readFileSync(path, 'utf8').trim(); | ||
|
||
const config = { | ||
service: 'gmail', | ||
auth: { | ||
user: process.env.MAIL_USER, | ||
pass: secretValue | ||
} | ||
} | ||
|
||
export default nodemailer.createTransport(config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import express from "express" | ||
import bodyParser from "body-parser" | ||
import {defaultErrorHandler, defaultResponseHandler, JwtHandler} from "core-components"; | ||
import MongooseConfig from "./mongoose.config"; | ||
import userRouter from "../routes/user.route"; | ||
import electionInfoRouter from "../routes/election.info.route"; | ||
import electionRouter from "../routes/election.route"; | ||
import codesRoute from "../routes/codes.route"; | ||
import {resolve} from "path"; | ||
import {createServer, Server} from "node:http"; | ||
import SocketIoConfig from "./socket.config"; | ||
import notificationsRoute from '../routes/notifications.route' | ||
|
||
const ServerConfig = (): Server => { | ||
JwtHandler.config({ | ||
ATPrivateKeyPath: resolve("./secrets/at_private.pem"), | ||
RTPrivateKeyPath: resolve("./secrets/rt_private.pem") | ||
}); | ||
|
||
MongooseConfig(); | ||
|
||
const app = express(); | ||
const httpServer = createServer(app); | ||
const io = SocketIoConfig(httpServer); | ||
|
||
// Express configurations | ||
app.use(express.json()); | ||
app.use(bodyParser.json()); | ||
app.use((req, res, next) => { | ||
res.setHeader("Access-Control-Allow-Origin", "*"); | ||
res.setHeader("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE, PATCH"); | ||
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization"); | ||
next(); | ||
}); | ||
|
||
// Routes initialization | ||
app.use("/users", userRouter); | ||
app.use("/election", electionRouter(io)); | ||
app.use("/election/info", electionInfoRouter); | ||
app.use("/code", codesRoute); | ||
app.use("/notifications", notificationsRoute); | ||
|
||
// Use custom response handler. | ||
app.use(defaultResponseHandler); | ||
|
||
// Use custom error handler. | ||
app.use(defaultErrorHandler); | ||
|
||
return httpServer; | ||
} | ||
|
||
export default ServerConfig |
Oops, something went wrong.