dfe-analytical-services / dfeR

Common R tasks in the Department for Education (DfE)
https://dfe-analytical-services.github.io/dfeR/
GNU General Public License v3.0
8 stars 2 forks source link

Feature/proxy #42

Closed adamrobinson361 closed 5 years ago

adamrobinson361 commented 5 years ago

Added an internal function to set up dfe proxy + link in documentation of how to run before installing package.

Note may want to consider exporting the function at a later date.

adamrobinson361 commented 5 years ago

@davidgoody-dfe - are you happy with me overriding the previous proxy change that you contributed with this.

The benefit of this approach is that it sets environment variables for both http and https. This means that you do not need to input the proxy each time you want to interact with web content in R. You just need to run this code when you change your password.

Added benefit of this is that it is not R specific. Tested that the following work with no additional proxies when this code is run:

Also note that renv (packrat replacement) seems to require our proxy to be set to work at all making this change valuable.

davidgoody-dfe commented 5 years ago

I wonder if the proxy part could be improved by deleting the password and 3 proxy variables once they have been used by the function. Whilst they exist there is the danger of them displaying the users password on screen within the R Studio environment as shown on the attached screenshot (it may be that keeping this within a standalone function avoids this though) image

adamrobinson361 commented 5 years ago

@davidgoody-dfe - I think that's because you are running the function internally. If you copy the whole function to R, put it in your environment and then run setup_proxy() you will find that it adds nothing to your environment.

Agreed we don't want it in your environment.

davidgoody-dfe commented 5 years ago

Happy with that change then.