Skip to contents

Open a connection to a BO server. You can keep parameters in environment variables

Usage

open_bo_connection(
  server = Sys.getenv("BO_SERVER"),
  username = Sys.getenv("BO_USERNAME"),
  password = NULL,
  conn = NULL,
  save_password = TRUE
)

Arguments

server

Server to connect to "server:port" (optional). Defaults BO_SERVER environment variable

username

(optional). Defaults to "BO_USERNAME environment variable

password

(optional). Use getPass() to enter value

conn

Connection reference to reuse (optional)

save_password

Save the password encrypted in the database

Value

Connection reference

Examples

# open a connection to the server in environment variable "BO_SERVER" using user in "BO_USERNAME".
# and password in the database
open_bo_connection()
#> Reference class object of class "request_reference_class"
#> Field "request":
#> <httr2_request>
#> GET https://boes42.croppcooperative.com:6425/biprws
#> Headers:
#> Error in "cli::cli_li(paste0(\"{.field \", names(x), \"}: \", vals))": ! Could not parse cli `{}` expression: `3&2=9191074,U3&2v=B…`.
#> Caused by error in `parse(text = code, keep.source = FALSE)`:
#> ! <text>:1:12: unexpected ','
#> 1: 3&2=9191074,
#>                ^
# open a connection to a server using username and password
open_bo_connection(Sys.getenv("BO_SERVER"), username = 'john.capehart', password=getPass())
#> Error in getPass(): could not find function "getPass"