I'd make a variable dyn_envs (or with a better name) that's $puppet::server_dynamic_environments || $puppet::server_git_repo and treat git_repo as a special case of dynamic environments. Then you can use that variable in the template as well. You could also make a check in that if server_git_repo is true, server_dynamic_environments must also be true.