AWQMS_credentials: Install AWQMS password and Stations database address in your...

View source: R/AWQMS_credentials.R

AWQMS_credentialsR Documentation

Install AWQMS password and Stations database address in your '.Renviron' file for repeated use

Description

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_Password")' 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.

Usage

AWQMS_credentials(AWQMS_usr, AWQMS_pass, overwrite = FALSE, install = TRUE)

Arguments

overwrite

If TRUE, will overwrite existing credentials that you already have in your '.Renviron' file.

install

If TRUE, will install the items in your '.Renviron' file for use in future sessions.

AWQMS_Password

The password to connect to AWQMS cloud ODBC connection

STATIONS_SERVER

The first three brackets of the STATIONS server address formatted in quotes. must end with . Example [SERVER].[database_name].[dbo].

Examples


## Not run: 
AWQMS_set_password(
   AWQMS_Password = "****",
  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_password(
   AWQMS_Password = "****",
  STATIONS_SERVER = "[SERVER].[database_name].[dbo].",
  overwrite = TRUE,
  install = TRUE
)
# Reload your environment to use the credentials

## End(Not run)

TravisPritchardODEQ/AWQMSdata documentation built on Nov. 10, 2024, 8:26 a.m.