Learn R Programming

notifyme (version 0.3.0)

save_private_keys: Create a place to store API keys

Description

This function will look for a 'keychain' file with your keys at the place you tell it to look with the file parameter. If it doesn't find it, it will make one.

Usage

save_private_keys(api_var = NULL, key = NULL, name_of_outputted_object = "api_keys", file = "~/r_keychain.rds")

Arguments

api_var
The name of the api key, this is user defined.
key
The actual key.
name_of_outputted_object
This is a convenience option, put in the name of the object you are assigning the output of the function to.
file
The name and location of the file where you want to store it. Default is unix home.

Intended use

Save variables in a way that can automatically get read in by my other functions in this package. For the hue lights the variables I expect to see in api_var are "hue_ip" and "hue_username", while for pushover, the variables I expect to see are "pushover_userkey" and "pushover_apitoken". See the example for a use example.

Details

This function WILL NOT actually save the file. Instead, it will return a dataframe with the keys, and give you the code to save the file to your system.

The intended use is store API keys in the home space.

Examples

Run this code
## Not run: api_keys <- save_private_keys("new_key","THE KEY")
## Not run: # message returned is Run this code: saveRDS(api_keys, '~/r_keychain.rds')
## Not run: saveRDS(api_keys, '~/r_keychain.rds')

Run the code above in your browser using DataLab