#!/bin/bash
exec sudo -g www-data /opt/openitc/frontend/bin/cake "$@"

# 18.12.2025 - We have to revert the --preserve-env as it makes issues with the NSTA
# sudo: sorry, you are not allowed to preserve the environment
#
#
# ITC-2986 keep all environment variables for config generation inside of docker containers
##preserveEnvSupportsList=$(sudo --help |grep "preserve-env" | wc -l)
##if [[ $preserveEnvSupportsList -gt 1 ]]; then
##    sudo -g www-data --preserve-env=OITC_DEBUG /opt/openitc/frontend/bin/cake "$@"
##else
    # Old sudo version that does not support list of environment variables to preserve
    # Added with 9bb78048656f 2017-08-03
#    sudo -g www-data --preserve-env /opt/openitc/frontend/bin/cake "$@"
##fi
