read_secret: Read Certe Secret From File

View source: R/universal.R

read_secretR Documentation

Read Certe Secret From File

Description

This function reads from a local or remote YAML file, as set in the environmental variable "secrets_file".

Usage

read_secret(property, file = Sys.getenv("secrets_file"))

Arguments

property

the property to read, case-sensitive

file

either a character string naming a file or a connection open for writing

Details

In the secrets file, the property name and value have to be separated with a colon (:), as is intended in YAML files.

The default value for file is the environmental variable "secrets_file".

The file will be read using read_yaml(), which allows almost any local path or remote connection (such as websites).

Examples

# for this example, create a temporary 'secrets' file
my_secrets_file <- tempfile(fileext = ".yaml")
Sys.setenv(secrets_file = my_secrets_file)
writeLines(c("tenant_id: 8fb3c03060e02e89",
             "default_users: user_1"),
           my_secrets_file)

read_secret("tenant_id")
read_secret("default_users")

certe-medical-epidemiology/certetoolbox documentation built on April 17, 2025, 3:24 a.m.