diff --git a/server/index.js b/server/index.js index a63acd0c..435097e8 100644 --- a/server/index.js +++ b/server/index.js @@ -36,6 +36,7 @@ const PORT = process.env.PORT || 4000; const CLIENT_ID = process.env.REACT_APP_SHARETRIBE_SDK_CLIENT_ID || '08ec69f6-d37e-414d-83eb-324e94afddf0'; const BASE_URL = process.env.REACT_APP_SHARETRIBE_SDK_BASE_URL || 'http://localhost:8088'; +const USING_SSL = process.env.REACT_APP_SHARETRIBE_USING_SSL === 'true'; const ENFORCE_SSL = process.env.SERVER_SHARETRIBE_ENFORCE_SSL === 'true'; const TRUST_PROXY = process.env.SERVER_SHARETRIBE_TRUST_PROXY || null; const app = express(); @@ -97,6 +98,7 @@ app.get('*', (req, res) => { clientId: CLIENT_ID, req, res, + secure: USING_SSL, }); const sdk = sharetribeSdk.createInstance({ diff --git a/src/config.js b/src/config.js index a7918a3f..5df95ea8 100644 --- a/src/config.js +++ b/src/config.js @@ -14,6 +14,9 @@ const currency = process.env.REACT_APP_SHARETRIBE_MARKETPLACE_CURRENCY || 'USD'; // Sentry DSN (Data Source Name), a client key for authenticating calls to Sentry const sentryDsn = process.env.REACT_APP_PUBLIC_SENTRY_DSN; +// If webapp is using SSL (i.e. it's behind 'https' protocol) +const usingSSL = process.env.REACT_APP_SHARETRIBE_USING_SSL === 'true'; + // Currency formatting options. // See: https://github.com/yahoo/react-intl/wiki/API#formatnumber // @@ -213,6 +216,7 @@ const config = { siteTwitterHandle, facebookAppId, sentryDsn, + usingSSL, }; export default config; diff --git a/src/index.js b/src/index.js index 96a07fee..3ac9263d 100644 --- a/src/index.js +++ b/src/index.js @@ -64,6 +64,7 @@ if (typeof window !== 'undefined') { const sdk = createInstance({ clientId: config.sdk.clientId, baseUrl: config.sdk.baseUrl, + secure: config.usingSSL, typeHandlers: [ { type: BigDecimal,