j40-cejst-2/client/gatsby-config.js
Vim USDS e571f80008 Add CSP plugin
- OWASP flagged a minor issue with CSP. Checking if this will fix the issue
2022-07-01 10:50:37 -07:00

125 lines
3.3 KiB
JavaScript

require('dotenv').config({
// NODE_ENV is automatically set to
// 'development' when the app is launched via 'npm start' or 'npm develop'
// 'production' when the app is launched via 'npm build'
// Depending on the node environment, the app will then use
// .env.production or .env.development for application
// env variables.
path: `.env.${process.env.NODE_ENV}`,
});
module.exports = {
siteMetadata: {
title: 'Justice40',
image: '/static/favicon.ico',
siteUrl: process.env.SITE_URL || 'http://localhost:8000',
},
pathPrefix: process.env.PATH_PREFIX || '',
plugins: [
{
resolve: 'gatsby-plugin-sass',
options: {
sassOptions: {
includePaths: [
'./node_modules/uswds',
],
},
cssLoaderOptions: {
modules: {
exportLocalsConvention: 'camelCaseOnly',
},
},
},
},
{
resolve: 'gatsby-plugin-intl',
options: {
// language JSON resource path
path: `${__dirname}/src/intl`,
// supported language
languages: [`en`, `es`],
// language file path
defaultLanguage: `en`,
// option to redirect to `/en` when connecting `/`
redirect: true,
},
},
{
resolve: 'gatsby-plugin-prettier-eslint',
options: {
prettier: {
patterns: [
// The pattern "**/*.{js,jsx,ts,tsx}" is
// not used because we will rely on `eslint --fix`
'**/*.{scss}',
'**/*.{json}',
'**/*.{graphql}',
'**/*.{md}',
'**/*.{html}',
'**/*.{yaml,yml}',
],
},
eslint: {
patterns: '**/*.{js,jsx,ts,tsx}',
ignorePatterns: ['public', 'node_modules', '*scss.d.ts'],
failOnError: true,
customOptions: {
fix: true,
cache: true,
},
},
},
},
'gatsby-plugin-react-helmet',
{
resolve: 'gatsby-plugin-robots-txt',
options: {
policy: [{userAgent: '*', allow: '/'}],
},
},
{
resolve: `gatsby-plugin-sitemap`,
options: {
excludes: [
'/',
'/about',
'/contact',
'/methodology',
'/404',
'/public-engagement',
'/downloads',
],
},
},
{
resolve: `gatsby-plugin-env-variables`,
options: {
allowList: ['DATA_SOURCE', 'MAPBOX_STYLES_READ_TOKEN'],
},
},
{
resolve: '@sentry/gatsby',
options: {
dsn: 'https://da0c28c22c9e4ff69d81650cabdec3d9@o1022662.ingest.sentry.io/5989007',
sampleRate: 0.7,
},
},
{
resolve: `gatsby-plugin-csp`,
options: {
disableOnDev: true,
reportOnly: false, // Changes header to Content-Security-Policy-Report-Only for csp testing purposes
mergeScriptHashes: true, // you can disable scripts sha256 hashes
mergeStyleHashes: true, // you can disable styles sha256 hashes
mergeDefaultDirectives: true,
directives: {
'script-src': '\'self\' www.google-analytics.com',
'style-src': '\'self\' \'unsafe-inline\'',
'img-src': '\'self\' data: www.google-analytics.com',
// you can add your directives or override defaults
},
},
},
],
};