diff --git a/index.js b/index.js index 6702861..db91ac4 100644 --- a/index.js +++ b/index.js @@ -13,13 +13,13 @@ var readline = require('readline'); //------------------------------------------------------- var options = { - key: fs.readFileSync('//var/www/forecast_api/key.pem'), - cert: fs.readFileSync('//var/www/forecast_api/cert.pem'), + key: fs.readFileSync(process.env.wd + 'key.pem'), + cert: fs.readFileSync(process.env.wd + 'cert.pem'), passprase: [] }; -https.createServer(options,server).listen(3000, () => { - console.log('started on 3000') +https.createServer(options,server).listen(process.env.nodeport, () => { + console.log('started on '+ process.env.nodeport) }); //server.listen(3000, () => console.log('started')) @@ -47,9 +47,9 @@ Postgres.FirstRow = function (inSQL, args, inResponse) { server.get('/', (req, res) => res.send('node.js express is up and running')) -server.get('/login', (req, res) => res.sendFile('//var/www/forecast_api/msauth.html')) +server.get('/login', (req, res) => res.sendFile(process.env.wd + 'msauth.html')) -server.get('/logs', (req, res) => res.sendFile('//var/www/forecast_api/logs.html')) +server.get('/logs', (req, res) => res.sendFile(process.env.wd + 'logs.html')) server.get('/test_sql', function(req, res){ diff --git a/route_sql/build/list_changes_table.sql b/route_sql/build/list_changes_table.sql index 3011b65..a6b7bfa 100644 --- a/route_sql/build/list_changes_table.sql +++ b/route_sql/build/list_changes_table.sql @@ -1,7 +1,7 @@ SELECT iterdef->>'user' "user", (iterdef->>'stamp')::timestamptz "stamp", - iterdef->>'mesasage' "comment", + iterdef->>'type' "type", round(SUM(fb_val_loc * r_rate)::numeric,2) sales, jsonb_pretty(iterdef) def FROM @@ -11,7 +11,7 @@ WHERE GROUP BY iterdef->>'user', iterdef->>'stamp', - iterdef->>'message', + iterdef->>'type', iterdef ORDER BY "stamp" DESC