Skip to content

Commit 8b941db

Browse files
committed
add a noauth option for localhost
1 parent 6271f7d commit 8b941db

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

powerwatch/cloud/powerwatch-visualization/powerwatch-visualization.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var command = require('commander');
1616

1717
command.option('-d, --database [database]', 'Database configuration file.')
1818
.option('-u, --username [username]', 'Database username file')
19+
.option('-n, --no-auth', 'disables authentication')
1920
.option('-p, --password [password]', 'Database password file').parse(process.argv);
2021

2122
var timescale_config = null;
@@ -99,7 +100,7 @@ console.log("Using timescale at " + timescale_config.host +
99100

100101
// Do a query of the deployments table so that we can load a map
101102
app.get('/init', (req, resp, next) => {
102-
if(!req.isAuthenticated()) {
103+
if(!req.isAuthenticated() && command.auth) {
103104
resp.redirect('/login');
104105
return;
105106
}
@@ -154,7 +155,7 @@ app.get('/init', (req, resp, next) => {
154155
});
155156

156157
app.get('/getData', (req, resp) => {
157-
if(!req.isAuthenticated()) {
158+
if(!req.isAuthenticated() && command.auth) {
158159
resp.redirect('/login');
159160
return;
160161
}
@@ -295,7 +296,7 @@ app.get('/login/google/return',
295296

296297

297298
app.get('/', function(req, res) {
298-
if(!req.isAuthenticated()) {
299+
if(!req.isAuthenticated() && command.auth) {
299300
res.redirect('/login');
300301
return;
301302
}

0 commit comments

Comments
 (0)