mirror of
https://gitlab.silvrtree.co.uk/martind2000/mdot_mqtt.git
synced 2025-01-27 11:56:18 +00:00
Added PGSQL controller
This commit is contained in:
parent
0d4d354855
commit
cca339d245
38
dbconfig.js
Normal file
38
dbconfig.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* User: Martin Donnelly
|
||||||
|
* Date: 2016-04-04
|
||||||
|
* Time: 14:46
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
var exec = require('child_process').exec;
|
||||||
|
|
||||||
|
|
||||||
|
function prepare_db() {
|
||||||
|
exec('psql -Upostgres -d oBrand -h localhost -f ./mdot.sql', function(err) {
|
||||||
|
if (err !== null) {
|
||||||
|
console.log('exec error: ' + err);
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
console.log('Done?');
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function createDB() {
|
||||||
|
'use strict';
|
||||||
|
exec('createdb -Upostgres -h localhost mdot', function(err) {
|
||||||
|
if (err !== null) {
|
||||||
|
console.log('exec error: ' + err);
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
prepare_db();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
createDB();
|
26
pg_hba.conf
Normal file
26
pg_hba.conf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Allow any user on the local system to connect to any database with
|
||||||
|
# any database user name using Unix-domain sockets (the default for local
|
||||||
|
# connections).
|
||||||
|
#
|
||||||
|
# TYPE DATABASE USER ADDRESS METHOD
|
||||||
|
local all all trust
|
||||||
|
|
||||||
|
# The same using local loopback TCP/IP connections.
|
||||||
|
#
|
||||||
|
# TYPE DATABASE USER ADDRESS METHOD
|
||||||
|
host all all 127.0.0.1/32 trust
|
||||||
|
|
||||||
|
# The same as the previous line, but using a separate netmask column
|
||||||
|
#
|
||||||
|
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
|
||||||
|
host all all 127.0.0.1 255.255.255.255 trust
|
||||||
|
|
||||||
|
# The same over IPv6.
|
||||||
|
#
|
||||||
|
# TYPE DATABASE USER ADDRESS METHOD
|
||||||
|
host all all ::1/128 trust
|
||||||
|
|
||||||
|
# The same using a host name (would typically cover both IPv4 and IPv6).
|
||||||
|
#
|
||||||
|
# TYPE DATABASE USER ADDRESS METHOD
|
||||||
|
host all all localhost trust
|
Loading…
Reference in New Issue
Block a user