-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: format openapi validator errors + additional env vars
- Loading branch information
Showing
10 changed files
with
132 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,34 @@ | ||
PORT= | ||
CLIENT_ID= | ||
|
||
# If you want to use Redis cache instead of in-memory cache, you can set the REDIS_URL | ||
REDIS_URL= | ||
NODE_ENV= | ||
SECRET_API_KEY= | ||
DEMO=true | ||
# If you want to use MongoDB instead of in-memory cache, you can set the MONGODB_URL | ||
# It's cheaper than Redis, but not as fast | ||
MONGODB_URL= | ||
|
||
# REAL will require you to provide x-exchange-api-key and x-exchange-api-secret headers | ||
# MOCK won't require to pass any exchange credentials | ||
MODE=REAL | ||
|
||
# If you want to build the SDK API locally, you need to have the access to the NPM package of the SDK | ||
# You can find credentials in the tech integration guide | ||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
|
||
# Used for HMAC authentication, to verify the request signature | ||
# You can leave it empty if you don't need an authentication | ||
# SECRET_API_KEY=ccaf48b2-c932-4dac-91ce-8acb0c28b18c | ||
|
||
# Your client id from the tech integration guide | ||
CLIENT_ID=sdk-*** | ||
|
||
# The proxy URL to be used for exchanges requiring IP whitelisting | ||
# /!\ Make sure to add a slash at the end of the URL | ||
PROXY_URL=https://<your-proxy-url>/ | ||
|
||
# The port to run the server on | ||
APP_PORT=3000 | ||
|
||
# The verbose mode | ||
# - "v": Additional logs. | ||
# - "vv": Prints all network requests/responses and logs. | ||
VERBOSE= |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { NextFunction, Request, Response } from 'express'; | ||
import { ErrorResponse } from '../types'; | ||
|
||
export function globalErrorHandler(err: any, req: Request, res: Response, next: NextFunction) { | ||
if (res.headersSent) { | ||
return next(err); | ||
} | ||
|
||
// Default status is 500 if not provided | ||
const status = err.status || 500; | ||
|
||
const errorResponse: ErrorResponse = { | ||
name: err.name || 'InternalServerError', | ||
code: status, | ||
message: err.message || 'An unexpected error occurred', | ||
originalErrorMessage: err.errors ? JSON.stringify(err.errors) : undefined, | ||
}; | ||
|
||
res.status(status).json(errorResponse); | ||
} |
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
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