gateway as proxy for tor

Search Whonix source code.

Dev/git - Kicksecure

Also:

General Tor question as per Self Support First Policy for Whonix
And no, I am not aware of such as Tor feature.
Consider posting a feature request against Tor.
You be able have to auto generate such a config file with a script.

Variables set in lexical lower configuration files will persist if they are not chaned in lexical higher configuration files.

whonix-firewall/usr/bin/whonix-gateway-firewall at master · Whonix/whonix-firewall · GitHub

real:

source_config_folder() {
   shopt -s nullglob
   local i
   for i in /etc/whonix_firewall.d/*.conf /rw/config/whonix_firewall.d/*.conf; do
      bash_n_exit_code="0"
      bash_n_output="$(bash -n "$i" 2>&1)" || { bash_n_exit_code="$?" ; true; };
      if [ ! "$bash_n_exit_code" = "0" ]; then
         echo "Invalid config file: $i
   bash_n_exit_code: $bash_n_exit_code
   bash_n_output:
   $bash_n_output" >&2
         exit 1
      fi
      source "$i"
   done
}

simpler for illustration:

for i in /etc/whonix_firewall.d/*.conf ; do
   source "$i"
done