codecov/gazebo

Set `GH_APP` similar to other environment vars in `start-nginx.sh`

imnotjames opened this issue ยท 3 comments

๐Ÿ“ฃ Feedback / ๐Ÿ› Bugs

When setting up the codecov frontend, GH_APP isn't easy to specify. This means that users with non-codecov github apps won't be able to add new organizations.

codecov/self-hosted#22

Either we can do the string replace patching in start-nginx somehow (A little tricker since codecov as a string is pretty ubiquitous) or find a way to inject window.configEnv during start-nginx.

Is there a preferable path for anyone else?

To do the sed patching it'd be something like..

GITHUB_APP_BASE=${CODECOV_GITHUB_APP_SEARCH:=codecov}
if [ -n "${CODECOV_GITHUB_APP}" ]; then
  echo "Replacing Github App ${GITHUB_APP_BASE} for ${CODECOV_GITHUB_APP}"
  sed -i "s/GH_APP:\"${GH_APP_BASE}\"/GH_APP:\"${CODECOV_GITHUB_APP}\"/g" /var/www/app/gazebo/static/js/main.*
fi

I can open a PR but I'm not sure if that's the desired path forward.

To make things faster I'll just open with that. After a bit of testing it seems to work fine and shouldn't have too many side effects. (As much as I think injecting window.configEnv is a better feature)