Created
September 20, 2011 14:47
-
-
Save stolsma/1229295 to your computer and use it in GitHub Desktop.
Downgrade process after connecting to port 80
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.listen(process.env.NODE_ENV === 'production' ? 80 : 8000, function() { | |
console.log('Ready'); | |
// if run as root, downgrade to the owner of this file | |
if (process.getuid() === 0) | |
require('fs').stat(__filename, function(err, stats) { | |
if (err) return console.log(err) | |
process.setuid(stats.uid); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment