aaronhurt / zfs-replicate

POSIX compliant shell script to manage ZFS snapshot replication locally, or between hosts.
69 stars 17 forks source link

Config file vs flags? #34

Closed tschettervictor closed 2 weeks ago

tschettervictor commented 3 weeks ago

I'm going to throw this out there as an option.

Would it be more practical to define the variables as flags rather than a separate config file? For example, for a remote replication you could do

zfs-replicate -t remote -m push -s 192.168.1.250

-m MODE -t TYPE -s REMOTE_SERVER -r RECURSIVE if flag is added -z REPLICATE_FROM_SCRATCH if flag is added -l LOGBASE (could be specified if needed, otherwise set by main script) etc...

Just a thought.

tschettervictor commented 3 weeks ago

I suppose this wouldn’t work too well with the replicate sets, and wouldn’t allow multiple hosts, sets and jobs in the same script.

tschettervictor commented 2 weeks ago

I’m going to reopen this as it would actually be fairly handy to have

-r (RECURSE_CHILDREN set to 1) -f (ALLOW_RECONCILIATION set to 1)

this way it wouldn’t be necessary to edit the config file during testing.

Close it if you feel adding the var in the command like “RECURSE_CHILDREN=1 zfs-replicate” would be enough

aaronhurt commented 2 weeks ago

The current script is 100% environment variable driven. The config file is sourced by the script if present - meaning the config file is just a collection of environment variables. I don't really use the config. I just test using environment variables.