Closed tom-sherman closed 6 years ago
There is no reliable, cross-platform way to automatically detect the external URL of a running Sails app
So, what should we do?
Could look for a few configuration values before using this deprecated method. Maybe then add an error message to advise to set one up?
I agree, I think that this should be set through an environment variable in future releases.
This will fail if 'sails.config.appUrl' is undefined.
I would suggest adding a check for undefined as well:
var baseUrl = '';
if (sails.config.appUrl && sails.config.appUrl !== null) {
baseUrl = sails.config.appUrl;
}
else {
sails.log.warn('Please add "appUrl" configuration value.');
baseUrl = sails.getBaseurl();
}
@Garland220 That's strange, I specifically remember testing for this case and it produced the expected result (a warning).
Is there a fix for this issue?
@TheSinding Which issue are you referring to? Both my solution and the hotfix have been merged into master
@tom-sherman he probably says that because your solution is not yet publish into npm.
Sorry I didnt answer until now @tom-sherman. Yeah @0aps is properly correct, when I tried with Sail 1.0 and the auth lib, I kept getting an sails.baseUrl() error..
Same here
(+1) It would be great if the npm package was updated with the latest release available on GitHub.
Is there a fix for this error?
Any fix?!!! It's too long since this issue has been opened. Please update the package!
As
getBaseURL()
is being deprecated in Sails v1.0, there should be implemented a more elegant way to define this.The offending bit in
passport.js
:Reference: