2022-04-12 10:55:09 +00:00
|
|
|
require("dotenv").config({
|
|
|
|
path: `.env.${process.env.NODE_ENV}`,
|
|
|
|
});
|
|
|
|
|
2022-02-28 15:39:50 +00:00
|
|
|
const { createProxyMiddleware } = require("http-proxy-middleware");
|
|
|
|
|
2022-04-12 10:55:09 +00:00
|
|
|
const { GATSBY_PORTAL_DOMAIN } = process.env;
|
|
|
|
|
2022-02-15 09:04:19 +00:00
|
|
|
module.exports = {
|
|
|
|
siteMetadata: {
|
2022-04-12 10:55:09 +00:00
|
|
|
title: `Accounts Dashboard`,
|
|
|
|
siteUrl: `https://account.${GATSBY_PORTAL_DOMAIN}`,
|
2022-02-15 09:04:19 +00:00
|
|
|
},
|
2022-03-25 16:47:44 +00:00
|
|
|
trailingSlash: "never",
|
2022-02-15 09:04:19 +00:00
|
|
|
plugins: [
|
2022-02-18 08:17:28 +00:00
|
|
|
"gatsby-plugin-image",
|
2022-02-21 08:30:39 +00:00
|
|
|
"gatsby-plugin-provide-react",
|
2022-02-18 08:17:28 +00:00
|
|
|
"gatsby-plugin-react-helmet",
|
|
|
|
"gatsby-plugin-sharp",
|
|
|
|
"gatsby-transformer-sharp",
|
2022-02-23 11:14:06 +00:00
|
|
|
"gatsby-plugin-styled-components",
|
2022-02-18 08:17:28 +00:00
|
|
|
"gatsby-plugin-postcss",
|
2022-02-17 11:16:21 +00:00
|
|
|
{
|
2022-02-18 08:17:28 +00:00
|
|
|
resolve: "gatsby-source-filesystem",
|
2022-02-15 09:04:19 +00:00
|
|
|
options: {
|
2022-02-18 08:17:28 +00:00
|
|
|
name: "images",
|
2022-04-07 10:59:20 +00:00
|
|
|
path: "./static/images/",
|
2022-02-15 09:04:19 +00:00
|
|
|
},
|
2022-02-18 08:17:28 +00:00
|
|
|
__key: "images",
|
2022-02-17 11:16:21 +00:00
|
|
|
},
|
|
|
|
],
|
2022-02-28 15:39:50 +00:00
|
|
|
developMiddleware: (app) => {
|
2022-04-12 10:55:09 +00:00
|
|
|
// Proxy Accounts service API requests:
|
2022-02-28 15:39:50 +00:00
|
|
|
app.use(
|
|
|
|
"/api/",
|
|
|
|
createProxyMiddleware({
|
2022-04-12 10:55:09 +00:00
|
|
|
target: `https://account.${GATSBY_PORTAL_DOMAIN}`,
|
|
|
|
secure: false, // Do not reject self-signed certificates.
|
|
|
|
changeOrigin: true,
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
// Proxy /skynet requests (e.g. uploads)
|
|
|
|
app.use(
|
|
|
|
["/skynet", "/__internal/"],
|
|
|
|
createProxyMiddleware({
|
|
|
|
target: `https://${GATSBY_PORTAL_DOMAIN}`,
|
2022-02-28 15:39:50 +00:00
|
|
|
secure: false, // Do not reject self-signed certificates.
|
|
|
|
changeOrigin: true,
|
2022-04-12 10:55:09 +00:00
|
|
|
pathRewrite: {
|
|
|
|
"^/skynet": "",
|
|
|
|
},
|
2022-02-28 15:39:50 +00:00
|
|
|
})
|
|
|
|
);
|
|
|
|
},
|
2022-02-18 08:17:28 +00:00
|
|
|
};
|