I have production ready R script, and from R script fetching some data from Oracle database,For dev I have hardcoded it , How to authenticate in production?
read the value from a configuration file (and just switch a dev / prod version of the config.txt file); this has possible extra benefit that you can gitignore the file if storing on GitHub or other public server
if the script is run in RStudio you can ask the user for authentication by calling
For credentials it probably does not really matter.
But in principle: when working on bigger projects I found it advantageous to have separate configuration file - I am not familiar with the config package - as either a text file or an entry in codebook table in database.
One advantage I mentioned already is version control - it is difficult to version control the contents of your renviron file; much more easily done with a small text file.
Another advantage is that you can easily have the config file temporary in nature - say if you have parameters governing a complicated migration. You have a version for development, another for testing (perhaps different ones for several rounds of testing) and then a production version, which you later replace with a "clean" production code in a later release.
For getting rid of the no-longer-required parameter it is easier to remove a file / entry in a codebook database than deleting an entry in renviron file.