#1595 Issue closed: Support 'export CONFIG_VAR=...' everywhere it makes sense

Labels: enhancement, fixed / solved / done

jsmeix opened issue at 2017-11-24 11:27:

In
https://github.com/rear/rear/pull/1593/commits/911b5830cd1524804da6ca70b118dd2133d66cbd
and
https://github.com/rear/rear/pull/1593/commits/b6238a9f15c9af4224e5852e28f167f46fe6badd
I set the MIGRATION_MODE and USER_INPUT_*
config variables in default.conf only if not already set
so that they can also be set individually by the user via
'export CONFIG_VAR=...' directly before running ReaR.

Hereby I propose to do that for all those config variables
where it makes sense in practice that the user may prefer
to set them individually via 'export CONFIG_VAR=...'
(and not statically in local.conf).

For a current use case example see
https://github.com/rear/rear/pull/1593#issuecomment-346628678

schlomo commented at 2017-11-25 18:07:

Can you describe the use case? This adds yet another configuration mechanism, this time from the command line. Why isn't it enough to specify a custom config file via -C? IIRC also DRLM added some kind of command line variable support.

Why not generalize this into a new command line option like -x MIGRATION_MODE=true that works for all variables, with multiple invocations on the same name adding values to arrays. I can imagine that this approach would reduce the amount of test "$FOO" || FOO=bar lines.

gdha commented at 2017-12-29 10:29:

@jsmeix I'm not a big fan of external defined variables - it is already complex enough for the users.

jsmeix commented at 2018-01-02 16:18:

This enhancement request emerged from my personal use case
where it makes sense for me for those config variables
that specify the user related behaviour during "rear recover".

I find it much more convenient when I can do things like

# export USER_INPUT_TIMEOUT=30
# export MIGRATION_MODE=y
# rear recover

compared to when I am forced to cumbersomely
edit /etc/rear/local.conf in the recovery system
only to change how one particular "rear recover" run
interacts with me.

In general it is traditional Unix way to support that the user
can control in particular user related behaviour of a program
via environment variables (and not only via command line
options or config file settings).

Accordingly I think this enhancement request does not
make sense for all those config variables that specify
what ReaR should do i.e. things like OUTPUT, BACKUP,
and so on - basically for all the core config variables
this enhancement request does not make sense.

jsmeix commented at 2020-03-06 13:51:

Done for several config variables in default.conf
where it is currently known to be useful so I close it.

If also needed for other config variables it can be
easily adapted in default.conf as needed.


[Export of Github issue for rear/rear.]