Skip to content
Merged
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
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,18 @@ AWS_ACCESS_KEY_ID = env.get("AWS_ACCESS_KEY_ID", "")
AWS_SECRET_ACCESS_KEY = env.get("AWS_SECRET_ACCESS_KEY", "")
```

### Database
### Database
You can either develop using the dev database, or use the local database provided in the docker compose file

Using the local database is detailed below, but both options will require the dev database password, so you will have to ask an RTP for this too

### Forcing evals/rtp or anything else
All of the role checking is done in `conditional/utils/user_dict.py`, and you can change the various functions to `return True` for debugging

### Using Sentry
If you want to opt-into logging errors through Sentry then set the `CONDITIONAL_SENTRY_ENV` environment variable to anything other than `local-development`.
Setting it to `local-development` or having the environment variable unset disables Sentry in both the frontend and backend (Re-building the container may be required).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Or having the environment variable unset"
Is this true?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting it to local-development disables sentry, if you don't set the variable it will default to local-development (it already defaulted to that). Is my phrasing confusing?




## Dependencies
Expand Down
11 changes: 6 additions & 5 deletions conditional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@
)

# Sentry setup
sentry_sdk.init(
dsn=app.config['SENTRY_DSN'],
integrations=[FlaskIntegration(), SqlalchemyIntegration()],
environment=app.config['SENTRY_ENV'],
)
if app.config['SENTRY_ENV'] != "local-development":
sentry_sdk.init(
dsn=app.config['SENTRY_DSN'],
integrations=[FlaskIntegration(), SqlalchemyIntegration()],
environment=app.config['SENTRY_ENV'],
)

ldap = CSHLDAP(app.config['LDAP_BIND_DN'],
app.config['LDAP_BIND_PW'],
Expand Down
21 changes: 12 additions & 9 deletions frontend/javascript/app.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
// Install Sentry to send errors to Sentry
import * as Sentry from '@sentry/browser';
Sentry.init(
{
dsn: 'https://[email protected]/133175'
}
);

// Capture unhandled exceptions in promises
window.addEventListener('unhandledrejection', err => {
Sentry.captureException(err.reason);
});
if (process.env.SENTRY_ENV !== "local-development") {
Sentry.init(
{
dsn: 'https://[email protected]/133175'
}
);

// Capture unhandled exceptions in promises
window.addEventListener('unhandledrejection', err => {
Sentry.captureException(err.reason);
});
}

// Load the rest of the modules
import "jquery";
Expand Down
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"bootstrap-icons": "^1.13.1",
"copy-webpack-plugin": "^14.0.0",
"css-loader": "^7.1.4",
"dotenv": "^18.0.5",
"eslint-config-google": "^0.14.0",
"expose-loader": "^5.0.1",
"imports-loader": "^5.0.0",
Expand Down
6 changes: 5 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin')
const path = require('path');
const sass = require('sass');
const dotenv = require('dotenv');

var jsSrc = path.resolve('./frontend');
var jsDest = path.resolve('./conditional/static');
var publicPath = 'static/js';

dotenv.config();

var babelQuery = {
"presets": ["@babel/preset-env"],
"plugins": []
Expand All @@ -25,7 +28,8 @@ var webpackConfig = {
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
'NODE_ENV': JSON.stringify('production'),
'SENTRY_ENV': JSON.stringify(process.env.CONDITIONAL_SENTRY_ENV ?? "local-development")
}
}),
new CopyPlugin({
Expand Down
Loading