Skip to content

Commit

Permalink
fix: voltran prod env control
Browse files Browse the repository at this point in the history
akuslular committed Jun 24, 2024
1 parent 4735ee0 commit 0c7eec5
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "voltranjs",
"version": "1.2.0-beta.16",
"version": "1.2.0-beta.19",
"main": "src/index.js",
"author": "Hepsiburada Technology Team",
"bin": {
3 changes: 2 additions & 1 deletion src/render.js
Original file line number Diff line number Diff line change
@@ -84,8 +84,9 @@ const render = async (req, res) => {
.observe(Date.now() - res.locals.startEpoch);
} else {
const voltranEnv = appConfig.voltranEnv || 'local';
const previewEnvControl = voltranEnv !== 'prod' && voltranEnv !== 'production';

if (voltranEnv !== 'prod' && isPreviewQuery) {
if (previewEnvControl && isPreviewQuery) {
const requestDispatcherResponse = await renderComponent(
new Component('/RequestDispatcher'),
context
6 changes: 5 additions & 1 deletion src/renderMultiple.js
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@ import { HTTP_STATUS_CODES } from './universal/utils/constants';
import logger from './universal/utils/logger';
import { getPreviewFile } from './universal/utils/previewHelper';

const appConfig = require('__APP_CONFIG__');

const getRenderOptions = req => {
const isPreviewValue = isPreview(req.query) || false;
const isWithoutHTMLValue = isWithoutHTML(req.query) || false;
@@ -271,8 +273,10 @@ const renderMultiple = async (req, res) => {
Object.keys(headers).forEach(key => {
res.setHeader(key, headers[key]);
});
const voltranEnv = appConfig.voltranEnv || 'local';
const previewEnvControl = voltranEnv !== 'prod' && voltranEnv !== 'production';

if (isPreview(req.query)) {
if (previewEnvControl && isPreview(req.query)) {
const preview = await getPreview(responses, requestCount, req);
res.html(preview);
} else {

0 comments on commit 0c7eec5

Please sign in to comment.