Package 'Environment'

Title: Manage Environment Variables
Description: Get or Set Environment Variables using .Renviron configuration file.
Authors: Flippie Coetser [aut, cre]
Maintainer: Flippie Coetser <[email protected]>
License: file LICENSE
Version: 0.0.1.004
Built: 2025-02-11 04:42:16 UTC
Source: https://github.com/FlippieCoetser/Environment

Help Index


Environment Variable Configurator

Description

Provides a suite of utility functions for managing environment variables in the .Renviron file. This includes initialization, retrieval, caching, and clearing of environment variables, enhancing secure management of sensitive data.

Usage

Configurator()

Details

The Configurator function initializes and provides access to the following utility functions:

Value

A list of utility functions that facilitate direct interactions with environment variables, structured as follows:

open.config.file

Opens or creates the .Renviron file, enabling the user to manage environment variables.

get.env.variable

Retrieves the value of an environment variable by its key.

cache.env.variable

Temporarily stores an environment variable value during the current R session.

clear.env.variable

Removes a cached environment variable from the current session.

Examples

# Initialize the configurator
configurator <- Environment::Configurator()

# Define the environment variable name and value
variable.name <- 'API_KEY'
variable.value <- '123456789'

#' # Set an environment variable for example purposes
Sys.setenv(API_KEY = variable.value)

# Retrieve an environment variable
variable.name |> configurator[['get.env.variable']]()

# Cache an environment variable
variable.name |> configurator[['cache.env.variable']](variable.value)

# Clear a cached environment variable
variable.name |> configurator[['clear.env.variable']]()

Environment Variable Orchestrator

Description

Provides a suite of utility functions for managing environment variables in the .Renviron file. This includes initialization, retrieval, caching, and clearing of environment variables, enhancing secure management of sensitive data.

Usage

Environment.Orchestrator()

Details

The Environment.Orchestrator function initializes and provides access to the following utility functions:

Value

A list of utility functions that facilitate direct interactions with environment variables, structured as follows:

open.config.file

Opens or creates the .Renviron file, enabling the user to manage environment variables.

get.env.variable

Retrieves the value of an environment variable by its key.

cache.env.variable

Temporarily stores an environment variable value during the current R session.

clear.env.variable

Removes a cached environment variable from the current session.