Skip to content

Commit

Permalink
Don't run auth on http and https (pick one)
Browse files Browse the repository at this point in the history
  • Loading branch information
awlayton committed Mar 16, 2021
1 parent 99cf0e4 commit 0a30a3b
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions oada/services/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,19 +508,21 @@ module.exports = function (conf) {
};

if (require.main === module) {
var app = module.exports();
var server1, server2;
const app = module.exports();
// Note: now we listen on both http and https by default. https is only
// for debugging trying to use localhost or 127.0.0.1, since that will resolve
// inside the container itself instead of as the overall host.
// if (config.get('auth:server:mode') === 'http') {
var server1 = app.listen(config.get('auth:server:port-http'), function () {
info('Listening HTTP on port %d', server1.address().port);
});
// } else {
var server2 = https.createServer(config.get('auth:certs'), app);
server2.listen(config.get('auth:server:port-https'), function () {
info('Listening HTTPS on port %d', server2.address().port);
});
// }
if (config.get('auth:server:mode') === 'http') {
const server1 = app.listen(
config.get('auth:server:port-http'),
function () {
info('Listening HTTP on port %d', server1.address().port);
}
);
} else {
const server2 = https.createServer(config.get('auth:certs'), app);
server2.listen(config.get('auth:server:port-https'), function () {
info('Listening HTTPS on port %d', server2.address().port);
});
}
}

0 comments on commit 0a30a3b

Please sign in to comment.