Skip to content

Commit 0c7eec5

Browse files
author
akuslular
committed
fix: voltran prod env control
1 parent 4735ee0 commit 0c7eec5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "voltranjs",
3-
"version": "1.2.0-beta.16",
3+
"version": "1.2.0-beta.19",
44
"main": "src/index.js",
55
"author": "Hepsiburada Technology Team",
66
"bin": {

src/render.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ const render = async (req, res) => {
8484
.observe(Date.now() - res.locals.startEpoch);
8585
} else {
8686
const voltranEnv = appConfig.voltranEnv || 'local';
87+
const previewEnvControl = voltranEnv !== 'prod' && voltranEnv !== 'production';
8788

88-
if (voltranEnv !== 'prod' && isPreviewQuery) {
89+
if (previewEnvControl && isPreviewQuery) {
8990
const requestDispatcherResponse = await renderComponent(
9091
new Component('/RequestDispatcher'),
9192
context

src/renderMultiple.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { HTTP_STATUS_CODES } from './universal/utils/constants';
1414
import logger from './universal/utils/logger';
1515
import { getPreviewFile } from './universal/utils/previewHelper';
1616

17+
const appConfig = require('__APP_CONFIG__');
18+
1719
const getRenderOptions = req => {
1820
const isPreviewValue = isPreview(req.query) || false;
1921
const isWithoutHTMLValue = isWithoutHTML(req.query) || false;
@@ -271,8 +273,10 @@ const renderMultiple = async (req, res) => {
271273
Object.keys(headers).forEach(key => {
272274
res.setHeader(key, headers[key]);
273275
});
276+
const voltranEnv = appConfig.voltranEnv || 'local';
277+
const previewEnvControl = voltranEnv !== 'prod' && voltranEnv !== 'production';
274278

275-
if (isPreview(req.query)) {
279+
if (previewEnvControl && isPreview(req.query)) {
276280
const preview = await getPreview(responses, requestCount, req);
277281
res.html(preview);
278282
} else {

0 commit comments

Comments
 (0)