Crates.io | cnc-rs |
lib.rs | cnc-rs |
version | 0.1.4 |
source | src |
created_at | 2024-12-22 02:04:57.85748+00 |
updated_at | 2024-12-23 17:51:17.754806+00 |
description | A Rust-based project for PostgreSQL replication and email notifications with a configurable CLI. |
homepage | https://github.com/terra-sync/cnc |
repository | https://github.com/terra-sync/cnc |
max_upload_size | |
id | 1491622 |
size | 108,713 |
CNC-RS is a Rust-based application for PostgreSQL database replication, configurable through a TOML file and a command-line interface (CLI). It features a robust logging system and optional email notifications to streamline database operations and ensure reliability.
pg_dump
and psql
.output.log
).cargo install
Install it using Cargo:
cargo install cnc-rs
Clone the repository:
git clone https://github.com/terra-sync/cnc
cd cnc-rs
Install globally using Cargo:
cargo install --path .
cnc <path-to-config.toml> [--verbose] [--email <true|false>]
--verbose
: Enables detailed logging to the console and output.log
.--email
: Overrides the email notification setting in the configuration file.cnc ./config.toml --verbose --email true
CNC-RS requires a configuration file in TOML format. Below is an example:
[postgres]
enabled = true
origin_host = "localhost"
origin_user = "postgres"
origin_password = "password"
origin_port = "5432"
origin_database = "source_db"
target_host = "localhost"
target_user = "postgres"
target_password = "password"
target_port = "5432"
target_database = "target_db"
backup_type = "Full" # Options: "Full" or "Schema"
[smtp]
enabled = true
username = "your_email_username"
password = "your_email_password"
smtp_host = "smtp.example.com"
smtp_port = 587
from = "your_email@example.com"
to = ["recipient1@example.com", "recipient2@example.com"]
cc = ["cc_recipient@example.com"]
[postgres]:
enabled
: Enables or disables PostgreSQL replication.origin_*
: Details for the source database.target_*
: Details for the target database.backup_type
: Type of backup (Full
or Schema
).[smtp]:
enabled
: Enables or disables email notifications.username
, password
: SMTP credentials.smtp_host
, smtp_port
: SMTP server details.from
: Email sender.to
: List of recipient emails.cc
: List of CC recipient emails (optional).Logs are generated in both the console and a file named output.log
. Each log entry includes:
INFO
, WARN
, ERROR
)Enable detailed logs using the --verbose
flag.
To contribute or modify this project:
Clone the repository:
git clone https://github.com/terra-sync/cnc
Build the project:
cargo build
Run tests:
cargo test
config.toml
) based on the example above.cnc ./config.toml --verbose --email true
output.log
for replication details.This project is licensed under the terms of both the MIT license and the GPL-3.0. See the LICENSE-MIT and LICENSE-GPL-3.0 files for details.
For bugs, patches, or help, please reach out through our groups.io: