Compare commits

..

No commits in common. "f2fd019aa87a8d68dc3f6c807e63d14c41eee646" and "12dabffffaef7c1637f53e07e010dc4ce2223568" have entirely different histories.

7 changed files with 11094 additions and 15428 deletions

View file

@ -41,7 +41,7 @@ dependencies to install correctly. See the instructions for
### Create your development database
Next, create two MySQL databases: `openneo_impress` and `openneo_id`. Then,
create a MySQL user named `impress_dev` with password `impress_dev`,
create a MySQL user named `impress_2020_dev` with password `impress_2020_dev`,
with full permissions for both databases.
(We're assuming that, on your local machine, your MySQL server isn't connected

View file

@ -61,8 +61,8 @@
"scripts": {
"prepare": "husky install",
"start": "next start",
"dev": "DB_ENV=development yarn build-cached-data && DB_ENV=development TS_NODE_COMPILER=typescript-cached-transpile next dev",
"local-prod": "DB_ENV=production yarn build-cached-data && DB_ENV=production TS_NODE_COMPILER=typescript-cached-transpile next dev",
"dev": "DB_ENV=development yarn build-cached-data && DB_ENV=development REACT_APP_IMPRESS_LOG_IN_AS=$IMPRESS_LOG_IN_AS TS_NODE_COMPILER=typescript-cached-transpile next dev",
"local-prod": "DB_ENV=production yarn build-cached-data && DB_ENV=production REACT_APP_IMPRESS_LOG_IN_AS=$IMPRESS_LOG_IN_AS TS_NODE_COMPILER=typescript-cached-transpile next dev",
"build": "yarn build-cached-data && next build",
"vercel-build": "yum install libuuid-devel libmount-devel && cp /lib64/{libuuid,libmount,libblkid}.so.1 node_modules/canvas/build/Release/",
"test": "jest test --env=jsdom",
@ -71,7 +71,7 @@
"deploy": "ansible-playbook -i deploy/inventory.cfg deploy/playbooks/deploy.yml",
"deploy-skip-build": "ansible-playbook -i deploy/inventory.cfg deploy/playbooks/deploy.yml --extra-vars='{\"skip_build\": true}'",
"mysql": "mysql --host=$(dotenv -p IMPRESS_MYSQL_HOST) --user=$(dotenv -p IMPRESS_MYSQL_USER) --password=$(dotenv -p IMPRESS_MYSQL_PASSWORD) --database=openneo_impress",
"mysql-dev": "mysql --host=localhost --user=impress_dev --password=impress_dev --database=openneo_impress",
"mysql-dev": "mysql --host=localhost --user=impress_2020_dev --password=impress_2020_dev --database=openneo_impress",
"mysql-admin": "mysql --host=$(dotenv -p IMPRESS_MYSQL_HOST) --user=matchu --password --database=openneo_impress",
"mysqldump": "mysqldump --host=$(dotenv -p IMPRESS_MYSQL_HOST) --user=$(dotenv -p IMPRESS_MYSQL_USER) --password=$(dotenv -p IMPRESS_MYSQL_PASSWORD)",
"setup-mysql": "yarn mysql-admin < scripts/setup-mysql.sql",

View file

@ -18,6 +18,27 @@ function useCurrentUser() {
isEnabled: authMode === "db",
});
// In development, you can start the server with
// `IMPRESS_LOG_IN_AS=12345 vc dev` to simulate logging in as user 12345.
//
// This flag shouldn't be present in prod anyway, but the dev check is an
// extra safety precaution!
//
// NOTE: In package.json, we forward the flag to REACT_APP_IMPRESS_LOG_IN_AS,
// because create-react-app only forwards flags with that prefix.
if (
process.env["NODE_ENV"] === "development" &&
process.env["REACT_APP_IMPRESS_LOG_IN_AS"]
) {
const id = process.env["REACT_APP_IMPRESS_LOG_IN_AS"];
return {
isLoading: false,
isLoggedIn: true,
id,
username: `<Simulated User ${id}>`,
};
}
if (authMode === "auth0") {
return currentUserViaAuth0;
} else if (authMode === "db") {

View file

@ -17,6 +17,18 @@ async function getJwtKey(header, callback) {
}
async function getUserIdFromToken(token) {
// In development, you can start the server with
// `IMPRESS_LOG_IN_AS=12345 vc dev` to simulate logging in as user 12345.
//
// This flag shouldn't be present in prod anyway, but the dev check is an
// extra safety precaution!
if (
process.env["NODE_ENV"] === "development" &&
process.env["IMPRESS_LOG_IN_AS"]
) {
return process.env["IMPRESS_LOG_IN_AS"];
}
if (!token) {
return null;
}

View file

@ -13,8 +13,8 @@ const defaultOptions =
process.env["DB_ENV"] === "development"
? {
host: "localhost",
user: "impress_dev",
password: "impress_dev",
user: "impress_2020_dev",
password: "impress_2020_dev",
database: "openneo_impress",
}
: {

26477
yarn.lock

File diff suppressed because it is too large Load diff