terra-sync / cnc

Seamless Database Replication tool
GNU General Public License v3.0
4 stars 2 forks source link

Configuration: Add `enabled` flag for email config #28

Closed charmitro closed 4 months ago

charmitro commented 5 months ago

Currently, email configuration does not have a toggle field (i.e. enabled = true or enabled = false), let's introduce it.

Another idea of mine is: Should we also have email = true on database sections in the configurations? For example,

Working:

[postgres]
email = true

[email]
enabled = true

Not working:

[postgres]
email = true

[email]
enabled = false

Not working (email disabled by default)

[postgres]
email = true

@panosfol Share your thoughts on this.

panosfol commented 4 months ago

So if we have an email field for each database section, that means that we notify the user for the databases that have email enabled, while ignoring the others right? I dont see a particular reason for someone to use our tool for lets say 3 different database systems, but receive an email for only 2. I think it complicates our .ini for no actual benefit.

charmitro commented 4 months ago

So if we have an email field for each database section, that means that we notify the user for the databases that have email enabled, while ignoring the others right? I dont see a particular reason for someone to use our tool for lets say 3 different database systems, but receive an email for only 2. I think it complicates our .ini for no actual benefit.

The idea behind CNC is to automate the multi-replication of databases. That means that our end-goal should be CNC being triggered like,

cnc -f config.ini -t postgres1

With -t or --target being the target section from the config.

To answer your question, a system admin would probably have two or three database configuration, based on their environment, a. development b. staging c. production I hardly believe they would want to send email that the development database is now replicated, but I strongly believe that they would want to send an email that the production database is replicated. If we don't have the presented feature, they'll need to have multiple configurations for no reason.

panosfol commented 4 months ago

Ok thats a really good point, I'll go ahead and implement it.

charmitro commented 4 months ago

I think we should move this and https://github.com/terra-sync/cnc/issues/24 for milestone v0.2.0. What do you think @panosfol ?

I also want to discuss the addition of Rust to our codebase, with first feature of it being email.

panosfol commented 4 months ago

I think we should move this and https://github.com/terra-sync/cnc/issues/24 for milestone v0.2.0. What do you think @panosfol ?

I also want to discuss the addition of Rust to our codebase, with first feature of it being email.

Yes I agree. About rust, you thinking we refractor the whole email process using rust? What's the benefits of it?

charmitro commented 4 months ago

About rust, you thinking we refractor the whole email process using rust? What's the benefits of it?

Easier to format email body and send out multiple emails, preferably using lettre-rs.

charmitro commented 4 months ago

Plus, I'd really like to the showcase Rust's power, and also Rust <-> C bindings power.