View source: R/AWQMS_set_servers.R
AWQMS_set_servers | R Documentation |
This function adds AWQMS and the server database addresses to your '.Renviron' file so it can be called securely without being stored in your code. After you have installed these two credentials, they can be called any time with 'Sys.getenv("AWQMS_SERVER")' or 'Sys.getenv("STATIONS_SERVER")'. I had some problems when on VPN that caused R to not look in the correct spot. You can run readRenviron("~/.Renviron") to force read the '.Renviron' file. The query functions will run ‘readRenviron("~/.Renviron")'to be sure it’s loaded correctly. If you do not have an '.Renviron' file, the function will create one for you. If you already have an '.Renviron' file, the function will append the key to your existing file, while making a backup of your original file for disaster recovery purposes. The point of this function is to not put SQL server address in public spaces such as github. The parameters used in the function MUST be kept secret. This code was very heavily borrowed from the qualtRics package authored by Julia Silge and Jasper Ginn.
AWQMS_set_servers(
AWQMS_SERVER,
STATIONS_SERVER,
overwrite = FALSE,
install = TRUE
)
AWQMS_SERVER |
The first three brackets of the AWQMS server address formatted in quotes. must end with . Example [SERVER].[database_name].[dbo]. |
STATIONS_SERVER |
The first three brackets of the STATIONS server address formatted in quotes. must end with . Example [SERVER].[database_name].[dbo]. |
overwrite |
If TRUE, will overwrite existing credentials that you already have in your '.Renviron' file. |
install |
If TRUE, will install the key in your '.Renviron' file for use in future sessions. |
## Not run:
AWQMS_set_servers(
AWQMS_SERVER = "[SERVER].[database_name].[dbo].",
STATIONS_SERVER = "[SERVER].[database_name].[dbo].",
install = TRUE
)
# Reload your environment so you can use the credentials without restarting R
readRenviron("~/.Renviron")
# You can check it with:
Sys.getenv("AWQMS_SERVER")
# If you need to overwrite existing credentials:
AWQMS_set_servers(
AWQMS_SERVER = "[SERVER].[database_name].[dbo].",
STATIONS_SERVER = "[SERVER].[database_name].[dbo].",
overwrite = TRUE,
install = TRUE
)
# Reload your environment to use the credentials
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.