From 268b646fd3b9d3dd79c4f31080032a6b060fa0f8 Mon Sep 17 00:00:00 2001 From: Rajath Date: Thu, 3 Feb 2022 14:14:29 +0530 Subject: [PATCH 1/6] Backend: If DShop is running on Amazon EC2, the AWS SES client should be created programatically, using credentials from EC2 metadata. Frontend: Try foregoing the request for the user's AWS credentials when they connect to AWS SES --- backend/utils/const.js | 4 +- backend/utils/emails/_getTransport.js | 25 +++++++++---- backend/utils/emails/newOrder.js | 4 +- backend/utils/emails/passwordReset.js | 2 +- backend/utils/emails/printfulOrderFailed.js | 2 +- backend/utils/emails/sellerContact.js | 2 +- backend/utils/emails/stripeWebhookError.js | 2 +- backend/utils/emails/verifyEmail.js | 2 +- shop/src/pages/admin/settings/Server.js | 3 +- shop/src/pages/admin/settings/apps/List.js | 10 ++++- shop/src/pages/super-admin/networks/_Form.js | 39 ++++++++++++++------ 11 files changed, 66 insertions(+), 29 deletions(-) diff --git a/backend/utils/const.js b/backend/utils/const.js index 69d3f28ae..b7954a43a 100644 --- a/backend/utils/const.js +++ b/backend/utils/const.js @@ -68,7 +68,8 @@ const { IPFS_GATEWAY, // IPFS gateway override BUCKET_PREFIX = DEFAULT_BUCKET_PREFIX, SERVICE_PREFIX = DEFAULT_SERVICE_PREFIX, - EXTERNAL_IP + EXTERNAL_IP, + AWS_MARKETPLACE_DEPLOYMENT //bool indicating whether the app is running from an AWS EC2 instance launched via the marketplace } = process.env /** @@ -128,6 +129,7 @@ module.exports = { BUCKET_PREFIX, SERVICE_PREFIX, EXTERNAL_IP, + AWS_MARKETPLACE_DEPLOYMENT, EXTERNAL_IP_SERVICE_URL, DEFAULT_INFRA_RESOURCES, DEFAULT_AWS_REGION, diff --git a/backend/utils/emails/_getTransport.js b/backend/utils/emails/_getTransport.js index 9ed5b87a0..5dae7b553 100644 --- a/backend/utils/emails/_getTransport.js +++ b/backend/utils/emails/_getTransport.js @@ -1,6 +1,6 @@ const nodemailer = require('nodemailer') const aws = require('aws-sdk') -// const { IS_TEST } = require('../const') +const { AWS_MARKETPLACE_DEPLOYMENT } = require('../const') const encConf = require('../encryptedConfig') function getTransportFromConfig(config) { @@ -24,12 +24,23 @@ function getTransportFromConfig(config) { } }) } else if (config.email === 'aws') { - const SES = new aws.SES({ - apiVersion: '2010-12-01', - region: config.awsRegion, - accessKeyId: config.awsAccessKey, - secretAccessKey: config.awsAccessSecret - }) + let SES + + if (AWS_MARKETPLACE_DEPLOYMENT) { + //Use the credentials from the EC2 Instance metadata + SES = new aws.SES({ + apiVersion: '2010-12-01' + }) + } else { + //Look up the shop admin's AWS credentials from 'config' + SES = new aws.SES({ + apiVersion: '2010-12-01', + region: config.awsRegion, + accessKeyId: config.awsAccessKey, + secretAccessKey: config.awsAccessSecret + }) + } + return nodemailer.createTransport({ SES }) } } diff --git a/backend/utils/emails/newOrder.js b/backend/utils/emails/newOrder.js index 81f0d1192..5eaad4bfe 100644 --- a/backend/utils/emails/newOrder.js +++ b/backend/utils/emails/newOrder.js @@ -159,8 +159,8 @@ async function sendNewOrderEmail({ ...varsOverride } - const htmlOutputVendor = mjml2html(vendor(vars), { minify: true }) - const htmlOutput = mjml2html(email(vars), { minify: true }) + const htmlOutputVendor = mjml2html(vendor(vars)) + const htmlOutput = mjml2html(email(vars)) const txtOutput = emailTxt(vars) const message = { diff --git a/backend/utils/emails/passwordReset.js b/backend/utils/emails/passwordReset.js index c3d9dc1f8..d207e1d6e 100644 --- a/backend/utils/emails/passwordReset.js +++ b/backend/utils/emails/passwordReset.js @@ -30,7 +30,7 @@ async function sendPasswordResetEmail({ network, seller, verifyUrl, skip }) { fromEmail: from } - const htmlOutput = mjml2html(forgotPassEmail(vars), { minify: true }) + const htmlOutput = mjml2html(forgotPassEmail(vars)) const txtOutput = forgotPassEmailTxt(vars) const message = { diff --git a/backend/utils/emails/printfulOrderFailed.js b/backend/utils/emails/printfulOrderFailed.js index 1884ada82..1ec10a40d 100644 --- a/backend/utils/emails/printfulOrderFailed.js +++ b/backend/utils/emails/printfulOrderFailed.js @@ -39,7 +39,7 @@ async function sendPrintfulOrderFailedEmail(shopId, orderData, opts, skip) { fromEmail: from } - const htmlOutput = mjml2html(printfulOrderFailed(vars), { minify: true }) + const htmlOutput = mjml2html(printfulOrderFailed(vars)) const txtOutput = printfulOrderFailedTxt(vars) const message = { diff --git a/backend/utils/emails/sellerContact.js b/backend/utils/emails/sellerContact.js index 2af536389..d63e718ff 100644 --- a/backend/utils/emails/sellerContact.js +++ b/backend/utils/emails/sellerContact.js @@ -35,7 +35,7 @@ async function sellerContactEmail({ network, seller, data, skip }) { fromEmail: from } - const htmlOutput = mjml2html(sellerContact(vars), { minify: true }) + const htmlOutput = mjml2html(sellerContact(vars)) const txtOutput = sellerContactTxt(vars) const message = { diff --git a/backend/utils/emails/stripeWebhookError.js b/backend/utils/emails/stripeWebhookError.js index 4e7a554ef..3d42585f8 100644 --- a/backend/utils/emails/stripeWebhookError.js +++ b/backend/utils/emails/stripeWebhookError.js @@ -32,7 +32,7 @@ async function stripeWebhookErrorEmail(shopId, errorData, skip) { ...errorData } - const htmlOutput = mjml2html(stripeWebhookError(vars), { minify: true }) + const htmlOutput = mjml2html(stripeWebhookError(vars)) const txtOutput = stripeWebhookErrorTxt(vars) const message = { diff --git a/backend/utils/emails/verifyEmail.js b/backend/utils/emails/verifyEmail.js index 0797cc80e..8a44976aa 100644 --- a/backend/utils/emails/verifyEmail.js +++ b/backend/utils/emails/verifyEmail.js @@ -24,7 +24,7 @@ async function sendVerifyEmail({ network, seller, verifyUrl, skip }) { const { name, email } = seller const vars = { head, name, verifyUrl, fromEmail: from } - const htmlOutput = mjml2html(verifyEmail(vars), { minify: true }) + const htmlOutput = mjml2html(verifyEmail(vars)) const txtOutput = verifyEmailTxt(vars) const message = { diff --git a/shop/src/pages/admin/settings/Server.js b/shop/src/pages/admin/settings/Server.js index aee59531b..ca45cb66d 100644 --- a/shop/src/pages/admin/settings/Server.js +++ b/shop/src/pages/admin/settings/Server.js @@ -277,7 +277,8 @@ const AdminSettings = ({ shop }) => { )} - {state.email !== 'aws' ? null : ( + {state.email !== 'aws' && + !process.env.AWS_MARKETPLACE_DEPLOYMENT ? null : ( <>
diff --git a/shop/src/pages/admin/settings/apps/List.js b/shop/src/pages/admin/settings/apps/List.js index 132d4d9b1..41164a423 100644 --- a/shop/src/pages/admin/settings/apps/List.js +++ b/shop/src/pages/admin/settings/apps/List.js @@ -2,6 +2,7 @@ import React, { useMemo, useState } from 'react' import fbt, { FbtParam } from 'fbt' import useShopConfig from 'utils/useShopConfig' +import useStateValue from 'data/state' import useEmailAppsList from 'utils/useEmailAppsList' import maskSecret from 'utils/maskSecret' @@ -17,6 +18,7 @@ import ProcessorsList from 'components/settings/ProcessorsList' const AppSettings = () => { const { shopConfig, refetch } = useShopConfig() + const [, dispatch] = useStateValue() const [connectModal, setShowConnectModal] = useState(false) const { emailAppsList } = useEmailAppsList({ shopConfig }) @@ -89,7 +91,13 @@ const AppSettings = () => { ModalToRender = SendgridModal break case 'aws': - ModalToRender = AWSModal + process.env.AWS_MARKETPLACE_DEPLOYMENT = true; + process.env.AWS_MARKETPLACE_DEPLOYMENT + ? dispatch({ + type: 'setConfigSimple', + config: { ...shopConfig, email: 'aws' } + }) + : (ModalToRender = AWSModal) break case 'mailgun': ModalToRender = MailgunModal diff --git a/shop/src/pages/super-admin/networks/_Form.js b/shop/src/pages/super-admin/networks/_Form.js index c1310f532..0c785329e 100644 --- a/shop/src/pages/super-admin/networks/_Form.js +++ b/shop/src/pages/super-admin/networks/_Form.js @@ -198,6 +198,32 @@ const NetworkForm = ({ onSave, network, feedback, className }) => { shopConfig: state.fallbackShopConfig }) + /* + * The Networks form should ask the shop admin for their AWS Credentials only when the DShop DApp is not deployed on an EC2 instance launched via AWS Marketplace. + * Reason: When DShop is deployed with the help of the Marketplace solution, the shop admin's AWS credentials can be obtained programatically. + * Reference: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#instance-metadata-security-credentials + */ + const conditionallyRequestAWSCreds = () => { + if (process.env.AWS_MARKETPLACE_DEPLOYMENT) { + return + } else { + return ( +
+
+ + + {Feedback('awsAccessKeyId')} +
+
+ + + {Feedback('awsSecretAccessKey')} +
+
+ ) + } + } + const ProcessorIdToEmailComp = { sendgrid: SendgridModal, aws: AWSModal, @@ -408,18 +434,7 @@ const NetworkForm = ({ onSave, network, feedback, className }) => { {Feedback('gcpCredentials')}
-
-
- - - {Feedback('awsAccessKeyId')} -
-
- - - {Feedback('awsSecretAccessKey')} -
-
+ {conditionallyRequestAWSCreds()}
From a42db7eef8e03b8951a7eb817b2e278fd16a302c Mon Sep 17 00:00:00 2001 From: Rajath Date: Thu, 3 Feb 2022 16:45:51 +0530 Subject: [PATCH 2/6] Frontend fixes: continued from previous commit --- shop/src/pages/admin/settings/apps/List.js | 41 ++++++++++++++++------ shop/src/utils/useEmailAppsList.js | 7 ++-- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/shop/src/pages/admin/settings/apps/List.js b/shop/src/pages/admin/settings/apps/List.js index 41164a423..374826858 100644 --- a/shop/src/pages/admin/settings/apps/List.js +++ b/shop/src/pages/admin/settings/apps/List.js @@ -2,7 +2,8 @@ import React, { useMemo, useState } from 'react' import fbt, { FbtParam } from 'fbt' import useShopConfig from 'utils/useShopConfig' -import useStateValue from 'data/state' +import { useStateValue } from 'data/state' +import useBackendApi from 'utils/useBackendApi' import useEmailAppsList from 'utils/useEmailAppsList' import maskSecret from 'utils/maskSecret' @@ -18,9 +19,13 @@ import ProcessorsList from 'components/settings/ProcessorsList' const AppSettings = () => { const { shopConfig, refetch } = useShopConfig() - const [, dispatch] = useStateValue() + const [{ config }, dispatch] = useStateValue() const [connectModal, setShowConnectModal] = useState(false) const { emailAppsList } = useEmailAppsList({ shopConfig }) + const { post } = useBackendApi({ authToken: true }) + + //Comment out the line below after testing is complete + process.env.AWS_MARKETPLACE_DEPLOYMENT = true const appsList = useMemo(() => { if (!shopConfig) return [] @@ -71,7 +76,29 @@ const AppSettings = () => { @@ -91,13 +118,7 @@ const AppSettings = () => { ModalToRender = SendgridModal break case 'aws': - process.env.AWS_MARKETPLACE_DEPLOYMENT = true; - process.env.AWS_MARKETPLACE_DEPLOYMENT - ? dispatch({ - type: 'setConfigSimple', - config: { ...shopConfig, email: 'aws' } - }) - : (ModalToRender = AWSModal) + ModalToRender = AWSModal break case 'mailgun': ModalToRender = MailgunModal diff --git a/shop/src/utils/useEmailAppsList.js b/shop/src/utils/useEmailAppsList.js index 8a8fb06e6..27da08bf3 100644 --- a/shop/src/utils/useEmailAppsList.js +++ b/shop/src/utils/useEmailAppsList.js @@ -33,9 +33,10 @@ const useEmailAppsList = ({ shopConfig }) => { { id: 'aws', title: 'AWS SES', - description: awsEnabled - ? `AWS SES Access Key: ${maskSecret(awsAccessKey, 12)}` - : 'Send emails using AWS SES', + description: + awsEnabled && !process.env.AWS_MARKETPLACE_DEPLOYMENT + ? `AWS SES Access Key: ${maskSecret(awsAccessKey, 12)}` + : 'Send emails using AWS SES', icon: , enabled: awsEnabled }, From 223908b8bb8b6568d954a99a463a67f492de250a Mon Sep 17 00:00:00 2001 From: Rajath Date: Fri, 4 Feb 2022 16:05:30 +0530 Subject: [PATCH 3/6] Frontend changes contd: Apply to Super-Admin Network config page --- shop/src/pages/admin/settings/apps/List.js | 5 --- shop/src/pages/super-admin/networks/_Form.js | 46 +++++++++++++++++--- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/shop/src/pages/admin/settings/apps/List.js b/shop/src/pages/admin/settings/apps/List.js index 374826858..d12faf0f1 100644 --- a/shop/src/pages/admin/settings/apps/List.js +++ b/shop/src/pages/admin/settings/apps/List.js @@ -19,7 +19,6 @@ import ProcessorsList from 'components/settings/ProcessorsList' const AppSettings = () => { const { shopConfig, refetch } = useShopConfig() - const [{ config }, dispatch] = useStateValue() const [connectModal, setShowConnectModal] = useState(false) const { emailAppsList } = useEmailAppsList({ shopConfig }) const { post } = useBackendApi({ authToken: true }) @@ -90,10 +89,6 @@ const AppSettings = () => { } catch (err) { console.error(err) } - // dispatch({ - // type: 'setConfig', - // config: { ...shopConfig, ...config, email: 'aws' } - // }) refetch() } else { setShowConnectModal(processor.id) diff --git a/shop/src/pages/super-admin/networks/_Form.js b/shop/src/pages/super-admin/networks/_Form.js index 0c785329e..c64a2744b 100644 --- a/shop/src/pages/super-admin/networks/_Form.js +++ b/shop/src/pages/super-admin/networks/_Form.js @@ -2,6 +2,7 @@ import React, { useState, useEffect, useMemo } from 'react' import { validateSelection } from '@origin/dshop-validation/matrix' import useSetState from 'utils/useSetState' +import useShopConfig from 'utils/useShopConfig' import { Networks } from 'data/Networks' import { formInput, formFeedback } from 'utils/formHelpers' import PasswordField from 'components/admin/PasswordField' @@ -145,6 +146,11 @@ function validate(state) { } const NetworkForm = ({ onSave, network, feedback, className }) => { + const { post } = useBackendApi({ authToken: true }) + const { refetch } = useShopConfig() + //Comment out the line below after testing is complete + process.env.AWS_MARKETPLACE_DEPLOYMENT = true + const [advanced, setAdvanced] = useState(false) // NOTE: defaultShopConfig is stored as string, probably // to make it editable from a text field. @@ -255,7 +261,25 @@ const NetworkForm = ({ onSave, network, feedback, className }) => { @@ -270,13 +294,21 @@ const NetworkForm = ({ onSave, network, feedback, className }) => { const selection = Object.keys(newState.infra).filter( (k) => newState.infra[k] ) - const validRes = validateSelection({ networkConfig: newState, selection }) - - if (!validRes.success) { - setState({ ...stateUpdate, infraErrors: validRes.errors }) - return false + const awsResources = ['aws-files', 'aws-cdn', 'aws-dns', 'aws-email'] + + //Validate selection only if it is something other than an AWS Resource, and DShop is not running on Amazon EC2. + //Reason: If DShop is running on EC2, it can connect to an[other] AWS resource automatically + if ( + !awsResources.includes(selection) || + !process.env.AWS_MARKETPLACE_DEPLOYMENT + ) { + const validRes = validateSelection({ networkConfig: newState, selection }) + + if (!validRes.success) { + setState({ ...stateUpdate, infraErrors: validRes.errors }) + return false + } } - setState({ ...stateUpdate, infraErrors: [] }) return true } From 6734569070c3eeb6838ba9aed4ce29c754161b43 Mon Sep 17 00:00:00 2001 From: Rajath Date: Tue, 8 Feb 2022 16:49:33 +0530 Subject: [PATCH 4/6] Frontend: Bug fix --- shop/src/pages/super-admin/networks/_Form.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/shop/src/pages/super-admin/networks/_Form.js b/shop/src/pages/super-admin/networks/_Form.js index c64a2744b..3586e1110 100644 --- a/shop/src/pages/super-admin/networks/_Form.js +++ b/shop/src/pages/super-admin/networks/_Form.js @@ -146,8 +146,6 @@ function validate(state) { } const NetworkForm = ({ onSave, network, feedback, className }) => { - const { post } = useBackendApi({ authToken: true }) - const { refetch } = useShopConfig() //Comment out the line below after testing is complete process.env.AWS_MARKETPLACE_DEPLOYMENT = true @@ -266,18 +264,14 @@ const NetworkForm = ({ onSave, network, feedback, className }) => { process.env.AWS_MARKETPLACE_DEPLOYMENT && processor.id == 'aws' ) { - try { - await post('/shop/config', { - method: 'PUT', - body: JSON.stringify({ email: 'aws' }), - suppressError: true - }) - } catch (err) { - console.error(err) - } - refetch() + setState({ + fallbackShopConfig: { + ...state.fallbackShopConfig, + email: 'aws' + } + }) } else { - setShowConnectModal(processor.id) + setConfigureEmailModal(processor.id) } }} > From 0cd8ca3f997eff1049eb303bf4a06794584de83b Mon Sep 17 00:00:00 2001 From: Rajath Date: Sat, 12 Feb 2022 15:18:07 +0530 Subject: [PATCH 5/6] Webpack will now load an env var to help the frontend determine whether the app is running on AWS EC2. Fields displayed on the Super Admin Network config page adjust accordingly. --- backend/scripts/aws/marketplace/startup_script.sh | 4 ++-- backend/utils/emails/_getTransport.js | 5 +++-- shop/src/pages/admin/settings/apps/List.js | 4 ---- shop/src/pages/super-admin/networks/_Form.js | 4 ---- shop/webpack.config.js | 4 +++- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/backend/scripts/aws/marketplace/startup_script.sh b/backend/scripts/aws/marketplace/startup_script.sh index f11df3186..345c7735f 100755 --- a/backend/scripts/aws/marketplace/startup_script.sh +++ b/backend/scripts/aws/marketplace/startup_script.sh @@ -64,8 +64,8 @@ sudo -u dshop yarn build:dist cd $BACKEND_PATH truncate -s 0 .env -# Env var indicating it is a AWS deployment. -echo "AWS_MARKETPLACE_DEPLOYMENT=true" >> .env +# Env var indicating it is a AWS deployment. Append this to the env files in both the 'backend' and 'shop' folders +echo "AWS_MARKETPLACE_DEPLOYMENT=true" | tee -a .env ../shop/.env # Encryption key for storing data securely in the DB. echo "ENCRYPTION_KEY=`openssl rand -base64 48`" >> .env diff --git a/backend/utils/emails/_getTransport.js b/backend/utils/emails/_getTransport.js index 5dae7b553..28c4d2fdd 100644 --- a/backend/utils/emails/_getTransport.js +++ b/backend/utils/emails/_getTransport.js @@ -1,6 +1,6 @@ const nodemailer = require('nodemailer') const aws = require('aws-sdk') -const { AWS_MARKETPLACE_DEPLOYMENT } = require('../const') +const { AWS_MARKETPLACE_DEPLOYMENT, DEFAULT_AWS_REGION } = require('../const') const encConf = require('../encryptedConfig') function getTransportFromConfig(config) { @@ -29,7 +29,8 @@ function getTransportFromConfig(config) { if (AWS_MARKETPLACE_DEPLOYMENT) { //Use the credentials from the EC2 Instance metadata SES = new aws.SES({ - apiVersion: '2010-12-01' + apiVersion: '2010-12-01', + region: DEFAULT_AWS_REGION }) } else { //Look up the shop admin's AWS credentials from 'config' diff --git a/shop/src/pages/admin/settings/apps/List.js b/shop/src/pages/admin/settings/apps/List.js index d12faf0f1..9af6f9cef 100644 --- a/shop/src/pages/admin/settings/apps/List.js +++ b/shop/src/pages/admin/settings/apps/List.js @@ -2,7 +2,6 @@ import React, { useMemo, useState } from 'react' import fbt, { FbtParam } from 'fbt' import useShopConfig from 'utils/useShopConfig' -import { useStateValue } from 'data/state' import useBackendApi from 'utils/useBackendApi' import useEmailAppsList from 'utils/useEmailAppsList' import maskSecret from 'utils/maskSecret' @@ -23,9 +22,6 @@ const AppSettings = () => { const { emailAppsList } = useEmailAppsList({ shopConfig }) const { post } = useBackendApi({ authToken: true }) - //Comment out the line below after testing is complete - process.env.AWS_MARKETPLACE_DEPLOYMENT = true - const appsList = useMemo(() => { if (!shopConfig) return [] diff --git a/shop/src/pages/super-admin/networks/_Form.js b/shop/src/pages/super-admin/networks/_Form.js index 3586e1110..776207248 100644 --- a/shop/src/pages/super-admin/networks/_Form.js +++ b/shop/src/pages/super-admin/networks/_Form.js @@ -2,7 +2,6 @@ import React, { useState, useEffect, useMemo } from 'react' import { validateSelection } from '@origin/dshop-validation/matrix' import useSetState from 'utils/useSetState' -import useShopConfig from 'utils/useShopConfig' import { Networks } from 'data/Networks' import { formInput, formFeedback } from 'utils/formHelpers' import PasswordField from 'components/admin/PasswordField' @@ -146,9 +145,6 @@ function validate(state) { } const NetworkForm = ({ onSave, network, feedback, className }) => { - //Comment out the line below after testing is complete - process.env.AWS_MARKETPLACE_DEPLOYMENT = true - const [advanced, setAdvanced] = useState(false) // NOTE: defaultShopConfig is stored as string, probably // to make it editable from a text field. diff --git a/shop/webpack.config.js b/shop/webpack.config.js index e8418ab24..6f72f599a 100644 --- a/shop/webpack.config.js +++ b/shop/webpack.config.js @@ -224,7 +224,9 @@ const webpackConfig = { DATA_DIR: process.env.DATA_DIR || '', CONTENT_CDN: process.env.CONTENT_CDN || '', CONTENT_HASH: process.env.CONTENT_HASH || '', - ABSOLUTE: process.env.ABSOLUTE || '' + ABSOLUTE: process.env.ABSOLUTE || '', + AWS_MARKETPLACE_DEPLOYMENT: + false || process.env.AWS_MARKETPLACE_DEPLOYMENT }), new MiniCssExtractPlugin({ filename: '[name].[contenthash:8].css' }) ], From 79841d654786ec30e13a5d531f4a6d5e56b7c93e Mon Sep 17 00:00:00 2001 From: Rajath Date: Tue, 15 Feb 2022 15:10:59 +0530 Subject: [PATCH 6/6] bug fixes --- shop/src/pages/super-admin/networks/_Form.js | 2 +- shop/webpack.config.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/shop/src/pages/super-admin/networks/_Form.js b/shop/src/pages/super-admin/networks/_Form.js index 776207248..8ac0ff761 100644 --- a/shop/src/pages/super-admin/networks/_Form.js +++ b/shop/src/pages/super-admin/networks/_Form.js @@ -289,7 +289,7 @@ const NetworkForm = ({ onSave, network, feedback, className }) => { //Validate selection only if it is something other than an AWS Resource, and DShop is not running on Amazon EC2. //Reason: If DShop is running on EC2, it can connect to an[other] AWS resource automatically if ( - !awsResources.includes(selection) || + !awsResources.includes(selection) && !process.env.AWS_MARKETPLACE_DEPLOYMENT ) { const validRes = validateSelection({ networkConfig: newState, selection }) diff --git a/shop/webpack.config.js b/shop/webpack.config.js index 6f72f599a..c324245db 100644 --- a/shop/webpack.config.js +++ b/shop/webpack.config.js @@ -225,8 +225,7 @@ const webpackConfig = { CONTENT_CDN: process.env.CONTENT_CDN || '', CONTENT_HASH: process.env.CONTENT_HASH || '', ABSOLUTE: process.env.ABSOLUTE || '', - AWS_MARKETPLACE_DEPLOYMENT: - false || process.env.AWS_MARKETPLACE_DEPLOYMENT + AWS_MARKETPLACE_DEPLOYMENT: null //use null by default. Otherwise, use the value for process.env.AWS_MARKETPLACE_DEPLOYMENT }), new MiniCssExtractPlugin({ filename: '[name].[contenthash:8].css' }) ],