diff --git a/base/scripts/onyxia-init.sh b/base/scripts/onyxia-init.sh index 75a2392e..bc156db5 100755 --- a/base/scripts/onyxia-init.sh +++ b/base/scripts/onyxia-init.sh @@ -147,6 +147,14 @@ if command -v R &>/dev/null; then fi env | grep "KUBERNETES" >> ${R_HOME}/etc/Renviron.site env | grep "IMAGE_NAME" >> ${R_HOME}/etc/Renviron.site + + # Configure rproj in rstudio + if command -v rstudio-server &>/dev/null; then + if [[ -n "$GIT_REPOSITORY" ]]; then + REPO_DIR=$(basename "$GIT_REPOSITORY" .git) + echo "setHook('rstudio.sessionInit', function(newSession) { if (newSession && identical(getwd(), '${WORKSPACE_DIR}')) { message('Activate RStudio project'); rstudioapi::openProject('${REPO_DIR}'); } }, action = 'append')" >> ${HOME}/.Rprofile + fi + fi fi if [[ "$DARK_MODE" == "true" ]]; then