Skip to content

Commit

Permalink
Merge pull request #63 from scandipwa/ssl-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ejnshtein authored Feb 7, 2022
2 parents 850ef98 + 07c627c commit 5ba1bc4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions build-packages/magento-scripts/lib/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,14 @@ module.exports = (yargs) => {
systemConfiguration: { analytics }
} = ctx;

const webLocation = `${ssl.enabled ? 'https' : 'http'}://${host}${ssl.enabled || ports.app === 80 ? '' : `:${ports.app}`}/`;

const block = new ConsoleBlock();
block
.addHeader('Magento 2')
.addEmptyLine()
.addLine(`Web location: ${logger.style.link(`${ssl.enabled ? 'https' : 'http'}://${host}${ports.app === 80 ? '' : `:${ports.app}`}/`)}`)
.addLine(`Magento Admin panel location: ${logger.style.link(`${ssl.enabled ? 'https' : 'http'}://${host}${ports.app === 80 ? '' : `:${ports.app}`}/${magentoConfiguration.adminuri}`)}`)
.addLine(`Web location: ${logger.style.link(webLocation)}`)
.addLine(`Magento Admin panel location: ${logger.style.link(`${webLocation}${magentoConfiguration.adminuri}`)}`)
.addLine(`Magento Admin panel credentials: ${logger.style.misc(magentoConfiguration.user)} - ${logger.style.misc(magentoConfiguration.password)}`);

const themes = await getCSAThemes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ module.exports = () => ({
config: { overridenConfiguration: { host, ssl } },
mysqlConnection
} = ctx;
const enableSecureFrontend = ssl.enabled ? '1' : '0';
const location = `${host}${ ports.app !== 80 ? `:${ports.app}` : '' }/`;
const secureLocation = `${host}/`; // SSL will work only on port 443, so you cannot run multiple projects with SSL at the same time.
const httpUrl = `http://${location}`;
const httpsUrl = `https://${location}`;

const enableSecureFrontend = ssl.enabled ? '1' : '0';
const httpsUrl = `https://${secureLocation}`;

await updateTableValues('core_config_data', [
{ path: 'web/unsecure/base_url', value: httpUrl },
Expand Down
2 changes: 1 addition & 1 deletion build-packages/magento-scripts/lib/tasks/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const start = () => ({
title: 'Opening browser',
skip: (ctx) => ctx.noOpen,
task: ({ ports, config: { overridenConfiguration: { host, ssl } } }) => {
openBrowser(`${ssl.enabled ? 'https' : 'http'}://${host}${ports.app === 80 ? '' : `:${ports.app}`}/`);
openBrowser(`${ssl.enabled ? 'https' : 'http'}://${host}${ssl.enabled || ports.app === 80 ? '' : `:${ports.app}`}/`);
},
options: {
showTimer: false
Expand Down

0 comments on commit 5ba1bc4

Please sign in to comment.