Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions api/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true
},
extends: [
'plugin:react/recommended',
'standard-with-typescript'
],
overrides: [
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json'
},
plugins: [
'react'
],
rules: {
}
}
15 changes: 12 additions & 3 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"watch/frontend": "NODE_ENV=development webpack watch --config ./src/frontend/webpack.config.js --mode development",
"watch/legacy": "NODE_ENV=development webpack watch --config ./src/legacy/webpack.config.js --mode development",
"watch/backend": "nodemon -L --watch src/backend --ext 'js,ts' src/backend/index.ts",
"debug/backend": "TS_NODE_PROJECT=./src/backend/tsconfig.json nodemon -L --watch src/backend --ext 'js,ts' --exec 'node --inspect=0.0.0.0:9229 --require ts-node/register src/backend/index.ts'"
"debug/backend": "TS_NODE_PROJECT=./src/backend/tsconfig.json nodemon -L --watch src/backend --ext 'js,ts' --exec 'node --inspect=0.0.0.0:9229 --require ts-node/register src/backend/index.ts'",
"lint": "npx eslint --fix ./src/backend & npx eslint --fix ./src/frontend"
},
"dependencies": {
"@aws-sdk/client-dynamodb": "^3.44.0",
Expand Down Expand Up @@ -59,6 +60,7 @@
"passport-jwt": "^4.0.0",
"passport-openidconnect": "^0.1.1",
"pg": "^8.7.1",
"prettier": "^2.8.4",
"pug": "^3.0.2",
"react": "^18.3.0-next-4fcc9184a-20230217",
"react-bootstrap": "^2.7.2",
Expand Down Expand Up @@ -95,7 +97,14 @@
"@types/passport-google-oauth20": "^2.0.11",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"css-loader": "^6.5.1",
"eslint": "^8.36.0",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.32.2",
"html-loader": "^3.0.1",
"jest": "^29.4.3",
"nodemon": "^2.0.15",
Expand All @@ -105,9 +114,9 @@
"ts-loader": "^9.3.1",
"ts-node": "^10.4.0",
"tslint": "^6.1.3",
"typescript": "^4.5.5",
"typescript": "*",
"webpack": "^5.65.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.10.0"
}
}
}
4 changes: 4 additions & 0 deletions api/src/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": false
}
38 changes: 19 additions & 19 deletions api/src/backend/config.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
export default {
environment: process.env.NODE_ENV || "development", // development, staging, or production
port: process.env.PORT || 3000,
session: {
secret: "armavirumquecano",
saveUninitialized: false,
resave: false,
environment: process.env.NODE_ENV || "development", // development, staging, or production
port: process.env.PORT || 3000,
session: {
secret: "armavirumquecano",
saveUninitialized: false,
resave: false,
},
oidc: {
google: {
clientID: process.env.GOOGLE_OAUTH2_CLIENT_ID,
clientSecret: process.env.GOOGLE_OAUTH2_CLIENT_SECRET,
issuer: "https://accounts.google.com",
authorizationURL: "https://accounts.google.com/o/oauth2/v2/auth",
tokenURL: "https://www.googleapis.com/oauth2/v4/token",
// FIXME: does this really need the host? Can it not just be off of "/" ?
callbackURL: `${process.env.WEB_HOST}/auth/oauth2/accounts.google.com/redirect`,
},
oidc: {
google: {
clientID: process.env.GOOGLE_OAUTH2_CLIENT_ID,
clientSecret: process.env.GOOGLE_OAUTH2_CLIENT_SECRET,
issuer: "https://accounts.google.com",
authorizationURL: "https://accounts.google.com/o/oauth2/v2/auth",
tokenURL: "https://www.googleapis.com/oauth2/v4/token",
// FIXME: does this really need the host? Can it not just be off of "/" ?
callbackURL: `${process.env.WEB_HOST}/auth/oauth2/accounts.google.com/redirect`,
}
},
imbueNetworkWebsockAddr: process.env.IMBUE_NETWORK_WEBSOCK_ADDR,
relayChainWebsockAddr: process.env.RELAY_CHAIN_WEBSOCK_ADDR
},
imbueNetworkWebsockAddr: process.env.IMBUE_NETWORK_WEBSOCK_ADDR,
relayChainWebsockAddr: process.env.RELAY_CHAIN_WEBSOCK_ADDR,
};
9 changes: 5 additions & 4 deletions api/src/backend/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import knex from "knex";
import knexfile from "./knexfile";
import config from "../config";


const validEnvironments = ["development", "staging", "production"];
const env = config.environment;

if (!(env && validEnvironments.includes(env))) {
throw new Error(
`Must export envvar \`NODE_ENV\` as one of: "${validEnvironments.join("\", \"")}"`
);
throw new Error(
`Must export envvar \`NODE_ENV\` as one of: "${validEnvironments.join(
'", "'
)}"`
);
}

type DBEnvironment = "development" | "staging" | "production";
Expand Down
Loading