refator: delete sensitive info
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-09-16 11:46:55 +02:00
parent afeed9757c
commit 6367f1ef05
3 changed files with 25 additions and 10 deletions

View File

@ -18,17 +18,16 @@ module.exports = Self => {
Self.closeTicket = async ctx => { Self.closeTicket = async ctx => {
const models = Self.app.models; const models = Self.app.models;
const config = await models.OsTicketConfig.findOne(); const config = await models.OsTicketConfig.findOne();
if (!config.user || !config.password)
return false;
const ostUri = `${config.host}/login.php`; const ostUri = `${config.host}/login.php`;
if (!config.user || !config.password || !config.userDb || !config.passwordDb)
return false;
const con = mysql.createConnection({ const con = mysql.createConnection({
host: 'localhost', host: `${config.hostDb}`,
user: 'osticket', user: `${config.userDb}`,
password: 'osticket', password: `${config.passwordDb}`,
port: 40003 port: `${config.portDb}`
}); });
const sql = `SELECT ot.ticket_id, ot.number const sql = `SELECT ot.ticket_id, ot.number

View File

@ -35,6 +35,18 @@
}, },
"comment": { "comment": {
"type": "string" "type": "string"
},
"hostDb": {
"type": "string"
},
"userDb": {
"type": "string"
},
"passwordDb": {
"type": "string"
},
"portDb": {
"type": "number"
} }
} }
} }

View File

@ -8,9 +8,13 @@ CREATE TABLE `vn`.`osTicketConfig` (
`action` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL, `action` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`day` int(11) DEFAULT NULL, `day` int(11) DEFAULT NULL,
`comment` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL, `comment` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`hostDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`userDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`passwordDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
`portDb` int(11) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT INTO `vn`.`osTicketConfig`(`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `action`, `day`, `comment`) INSERT INTO `vn`.`osTicketConfig`(`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `action`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`)
VALUES VALUES
(0, 'http://localhost:56596/scp', '', '', 'open', 3, 'Cerrar', 60, 'Este CAU se ha cerrado automáticamente'); (0, 'https://cau.verdnatura.es/scp', NULL, NULL, 'open', 3, 'Cerrar', 60, 'Este CAU se ha cerrado automáticamente', NULL, NULL, NULL, NULL);