+ Updated the configuration File
+ Writing a wrapper for the config file to be imported into the program
This commit is contained in:
parent
2b403de286
commit
398e292e34
|
@ -1,8 +1,10 @@
|
||||||
{
|
{
|
||||||
"options": {
|
"options": {
|
||||||
"parallel_nodes": 2,
|
"parallel_nodes": 2,
|
||||||
"parallel_node_tasks": 5
|
"parallel_node_tasks": 5,
|
||||||
|
"separate_into_tables": false
|
||||||
},
|
},
|
||||||
|
|
||||||
"smtp": {
|
"smtp": {
|
||||||
"host": "",
|
"host": "",
|
||||||
"port": "",
|
"port": "",
|
||||||
|
@ -11,6 +13,7 @@
|
||||||
"password": "",
|
"password": "",
|
||||||
"email_from": ""
|
"email_from": ""
|
||||||
},
|
},
|
||||||
|
|
||||||
"nodes": [
|
"nodes": [
|
||||||
{
|
{
|
||||||
"name": "Main Connection",
|
"name": "Main Connection",
|
||||||
|
@ -19,7 +22,7 @@
|
||||||
"mail": {
|
"mail": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"email_to": "",
|
"email_to": "",
|
||||||
"email_cc": ""
|
"email_cc": []
|
||||||
},
|
},
|
||||||
|
|
||||||
"hostname": "localhost",
|
"hostname": "localhost",
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mysql": "^2.18.1"
|
"@types/nodemailer": "^6.4.4",
|
||||||
|
"mysql": "^2.18.1",
|
||||||
|
"nodemailer": "^6.6.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,144 @@
|
||||||
|
/**
|
||||||
|
* A Collection of settings
|
||||||
|
*/
|
||||||
|
interface ConfigOptions {
|
||||||
|
/**
|
||||||
|
* The number of nodes that will be ran in parallel,
|
||||||
|
* if the number of nodes is smaller than the parallels,
|
||||||
|
* it will simply divide them evenly and ignore extra parallels
|
||||||
|
*/
|
||||||
|
parallel_nodes: number,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of tasks that a node parallel can run at once,
|
||||||
|
* these basically are mysql_dump processes.
|
||||||
|
*/
|
||||||
|
parallel_node_tasks: number,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This option should be set to ON if you would like the dumps
|
||||||
|
* to only export tables.
|
||||||
|
*/
|
||||||
|
separate_into_tables: boolean,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic configuration interface for the mailer
|
||||||
|
*/
|
||||||
|
interface SMTPConfig {
|
||||||
|
/**
|
||||||
|
* The email address to globally use for sending
|
||||||
|
* out email from.
|
||||||
|
*/
|
||||||
|
email_from : string,
|
||||||
|
/**
|
||||||
|
* Email username login details
|
||||||
|
*/
|
||||||
|
username : string,
|
||||||
|
/**
|
||||||
|
* Email password login details
|
||||||
|
*/
|
||||||
|
password : string,
|
||||||
|
/**
|
||||||
|
* The SMTP host of the email
|
||||||
|
*/
|
||||||
|
host : string,
|
||||||
|
/**
|
||||||
|
* The port to send to, common ports are 465 ( ssl ), 587 for TLS
|
||||||
|
*/
|
||||||
|
port : string,
|
||||||
|
/**
|
||||||
|
* Secure Connection
|
||||||
|
*/
|
||||||
|
ssl : boolean,
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NodeConnectionMail {
|
||||||
|
/**
|
||||||
|
* Enable or disable email sending
|
||||||
|
*/
|
||||||
|
enabled : boolean,
|
||||||
|
/**
|
||||||
|
* The main user to send out the email to
|
||||||
|
*/
|
||||||
|
email_to: string,
|
||||||
|
/**
|
||||||
|
* A list of email addresses to CC into the email
|
||||||
|
*/
|
||||||
|
email_cc: Array<string>,
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DatabaseFilter {
|
||||||
|
/**
|
||||||
|
* A filter where anything inside of it is going to be ignored
|
||||||
|
*/
|
||||||
|
blacklist?: null | Array<string>,
|
||||||
|
/**
|
||||||
|
* A filter where anything out of it will be ignored
|
||||||
|
*/
|
||||||
|
whitelist?: null | Array<string>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Node Connection for the database backup
|
||||||
|
*/
|
||||||
|
interface NodeConnection {
|
||||||
|
/**
|
||||||
|
* The name for the connection to be identified by
|
||||||
|
*/
|
||||||
|
name : string,
|
||||||
|
/**
|
||||||
|
* Send out console debug messages
|
||||||
|
*/
|
||||||
|
debug : string,
|
||||||
|
/**
|
||||||
|
* Keep a log file for this connection independently
|
||||||
|
*/
|
||||||
|
log : boolean,
|
||||||
|
/**
|
||||||
|
* Mail configuration details
|
||||||
|
*/
|
||||||
|
mail? : NodeConnectionMail | null,
|
||||||
|
/**
|
||||||
|
* Ip Address of the database
|
||||||
|
*/
|
||||||
|
hostname : string,
|
||||||
|
/**
|
||||||
|
* The username for the database connection
|
||||||
|
*/
|
||||||
|
username : string,
|
||||||
|
/**
|
||||||
|
* The password to connect to the database with
|
||||||
|
*/
|
||||||
|
password : string,
|
||||||
|
/**
|
||||||
|
* The database filter, this can contain a blacklist or a whitelist.
|
||||||
|
*/
|
||||||
|
databases?: DatabaseFilter
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ConfigObject {
|
||||||
|
/**
|
||||||
|
* A list of global settings for the behaviour
|
||||||
|
* of the exporter
|
||||||
|
*/
|
||||||
|
options: ConfigOptions,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP details for sending out email notifications
|
||||||
|
* for real-time updates on erros, health, and backups.
|
||||||
|
*/
|
||||||
|
smtp: SMTPConfig,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of Node connections that we should backup
|
||||||
|
*/
|
||||||
|
nodes: Array<NodeConnection>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getConfig() : ConfigObject | null {
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
import nodemailer from "nodemailer";
|
||||||
|
|
||||||
|
function getTransporter() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export function sendMail(mailContent: string, toAddress: string, ccAddresses?: Array<string>) {
|
||||||
|
|
||||||
|
}
|
Reference in New Issue