MCPcopy Create free account
hub / github.com/Devographics/Monorepo / checkSecretKey

Function checkSecretKey

api/src/server.ts:84–95  ·  view source on GitHub ↗
(req: Request, res: Response, func: () => Promise<void>)

Source from the content-addressed store, hash-verified

82 * @param func
83 */
84const checkSecretKey = async (req: Request, res: Response, func: () => Promise<void>) => {
85 const secretKey = getEnvVar(EnvVar.SECRET_KEY, {
86 hardFail: true,
87 calledFrom: 'checkSecretKey'
88 })
89 if (req?.query?.key !== secretKey) {
90 // throw new Error('Authorization error')
91 res.status(401).send('Not authorized')
92 } else {
93 await func()
94 }
95}
96
97// if SURVEYS_URL is defined, then use that to load surveys;
98// if not, look in local filesystem

Callers 1

startFunction · 0.70

Calls 1

getEnvVarFunction · 0.90

Tested by

no test coverage detected