Skip to content

Commit

Permalink
build(dev): local run, content security policy update (#880)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera committed Mar 8, 2022
1 parent 2d0a63b commit c9d5940
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
10 changes: 0 additions & 10 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,3 @@ DEV_PORT=3000
DEV_BRANCH=stage-stable

REACT_APP_ENV=development

REACT_APP_SERVICES_RHSM_VERSION=http://localhost:5000/api/rhsm-subscriptions/v1/version
REACT_APP_SERVICES_RHSM_REPORT=http://localhost:5000/api/rhsm-subscriptions/v1/tally/products/
REACT_APP_SERVICES_RHSM_TALLY=http://localhost:5000/api/rhsm-subscriptions/v1/tally/products/{0}/{1}
REACT_APP_SERVICES_RHSM_CAPACITY=http://localhost:5000/api/rhsm-subscriptions/v1/capacity/products/
REACT_APP_SERVICES_RHSM_INVENTORY=http://localhost:5000/api/rhsm-subscriptions/v1/hosts/products/
REACT_APP_SERVICES_RHSM_INVENTORY_GUESTS=//localhost:5000/api/rhsm-subscriptions/v1/hosts/{0}/guests
REACT_APP_SERVICES_RHSM_INVENTORY_INSTANCES=//localhost:5000/api/rhsm-subscriptions/v1/instances/products/
REACT_APP_SERVICES_RHSM_INVENTORY_SUBSCRIPTIONS=//localhost:5000/api/rhsm-subscriptions/v1/subscriptions/products/
REACT_APP_SERVICES_RHSM_OPTIN=http://localhost:5000/api/rhsm-subscriptions/v1/opt-in
19 changes: 16 additions & 3 deletions config/spandx.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
/**
* Set proxy routes.
* Set dev run routes.
*
* @returns {object}
*/
const setDevRoutes = () => ({
routes: {
'/api/rhsm-subscriptions': {
host: `http://localhost:5000`
}
}
});

/**
* Set proxy run routes.
*
* @param {object} params
* @param {string} params.DEV_PORT
* @param {string} params.BETA_PREFIX
* @returns {object}
*/
const setProxyRoutes = ({ DEV_PORT, BETA_PREFIX = '' }) => ({
const setProxyRoutes = ({ DEV_PORT, BETA_PREFIX = '' } = {}) => ({
routes: {
'/locales': {
host: `https://localhost:${DEV_PORT}${BETA_PREFIX}/apps/subscriptions`
}
}
});

module.exports = setProxyRoutes;
module.exports = { setDevRoutes, setProxyRoutes };
2 changes: 2 additions & 0 deletions config/webpack.dev.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const config = require('@redhat-cloud-services/frontend-components-config');
const { setHtmlPlugin, setReplacePlugin, setCommonPlugins } = require('./build.plugins');
const { setupDotenvFilesForEnv } = require('./build.dotenv');
const { setDevRoutes } = require('./spandx.config');

const { _BUILD_RELATIVE_DIRNAME, DEV_BRANCH, DEV_PORT } = setupDotenvFilesForEnv({ env: process.env.NODE_ENV });

Expand All @@ -12,6 +13,7 @@ const { config: webpackConfig, plugins } = config({
env: (/(prod|stage|qa|ci)(-stable|-beta)$/.test(DEV_BRANCH) && DEV_BRANCH) || 'prod-stable',
port: Number.parseInt(DEV_PORT, 10),
rootFolder: _BUILD_RELATIVE_DIRNAME,
routes: setDevRoutes(),
standalone: true,
useProxy: false,
htmlPlugin: setHtmlPlugin(),
Expand Down
2 changes: 1 addition & 1 deletion config/webpack.proxy.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const config = require('@redhat-cloud-services/frontend-components-config');
const { setHtmlPlugin, setReplacePlugin, setCommonPlugins } = require('./build.plugins');
const { setupDotenvFilesForEnv } = require('./build.dotenv');
const setProxyRoutes = require('./spandx.config');
const { setProxyRoutes } = require('./spandx.config');

const { _BUILD_RELATIVE_DIRNAME, DEV_BRANCH, DEV_PORT } = setupDotenvFilesForEnv({
env: 'proxy'
Expand Down

0 comments on commit c9d5940

Please sign in to comment.