Skip to content

Commit

Permalink
[fix] update logic to display local URL (#7285)
Browse files Browse the repository at this point in the history
* fix(lift.js): update logic to display local URL

* fix(lift.js): use .isEmpty from lodash to check sails.config.ssl)

* Specify behavior of _.isEmpty and pulled env check first to derisk future changes

* Fix lint

---------

Co-authored-by: Eric <[email protected]>
  • Loading branch information
DominusKelvin and eashaw authored Jul 7, 2023
1 parent ceb0f3b commit c7dcb10
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions lib/app/lift.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,7 @@ module.exports = function lift(configOverride, done) {
sails.log.ship && sails.log.ship();
sails.log.info(('Server lifted in `' + sails.config.appPath + '`'));

// > Note that we don't try to include the "To see your app, visit this URL" stuff
// > unless we're pretty sure which URL it would be a good idea to try and visit.
// > (even then, it's not 100% or anything. But at least with these checks, it's
// > not wrong MOST of the time.)
if (!sails.config.ssl && !sails.config.http.serverOptions && !sails.config.explicitHost && process.env.NODE_ENV !== 'production') {
sails.log.info(chalk.underline('To see your app, visit http://localhost:'+sails.config.port));
}

sails.log.info(('To shut down Sails, press <CTRL> + C at any time.'));
sails.log.info(('Read more at '+chalk.underline('https://sailsjs.com/support')+'.'));
sails.log.blank();
Expand All @@ -109,6 +103,19 @@ module.exports = function lift(configOverride, done) {
sails.log('Host : ' + sails.config.explicitHost); // 12 - 4 = 8 spaces
}
sails.log('Port : ' + sails.config.port); // 12 - 4 = 8 spaces

// > Note that we don't try to include the "Local: " stuff
// > unless we're pretty sure which URL it would be a good idea to try and visit.
// > (even then, it's not 100% or anything. But at least with these checks, it's
// > not wrong MOST of the time.)
if (process.env.NODE_ENV !== 'production' &&
(!sails.config.ssl || _.isEqual(sails.config.ssl, {})) &&
!sails.config.http.serverOptions &&
!sails.config.explicitHost
) {
sails.log('Local : ' + chalk.underline('http://localhost:'+sails.config.port));
}

sails.log.verbose('NODE_ENV : ' + (process.env.NODE_ENV||chalk.gray('(not set)'))); // 12 - 8 - 2 = 2 spaces
sails.log.silly();
sails.log.silly('Version Info:');
Expand All @@ -131,5 +138,3 @@ module.exports = function lift(configOverride, done) {

});//</async.series()>
};


0 comments on commit c7dcb10

Please sign in to comment.