-
Notifications
You must be signed in to change notification settings - Fork 3
/
01 infoSaveKeys.Rmd
43 lines (29 loc) · 1.2 KB
/
01 infoSaveKeys.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
title: "01 Keys"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Where we should write keys:
http://www.dartistics.com/renviron.html
# R Startup Files
R has a couple of “startup” files:
* `.Rprofile` gets executed every time R starts up, so, if you always want to run some specific script, you can put it in the .Rprofile file.
* `.Renviron` also gets evaluated every time an R session starts, but its sole purpose is to set environment variables.
We’re not going to go into detail on .Rprofile here, as it’s not used for the API key protection that we’re covering.
So, there’s a .Renviron file. File that away for now.
# The .Rprofile file is loaded from the lowest hierarchy:
1. From this place if exists `getwd()`
2. If not, from this `R.home()`
2. In the last of all from `Sys.getenv("HOME")`
# How we can create a file in windows batch:
`type nul > your_file.txt`
# structure of .Rprofile:
```
GCE_AUTH_FILE="C:/Users/ludwi/Documents/GCP_klucze/kurs-gcp-fbfb57e6c23b.json"
GCE_DEFAULT_PROJECT_ID="kurs-gcp"
GCS_DEFAULT_BUCKET="kurs-gcp-bucket"
CR_REGION="europe-west1"
CR_BUILD_EMAIL=googlecloudrunner@kurs-gcp.iam.gserviceaccount.com
```