# Using `options()`
old_opts <- options(plumber2.port = 9889L)
get_opts("port")
options(old_opts)
# Using environment variables
old_env <- Sys.getenv("PLUMBER2_PORT")
Sys.setenv(PLUMBER2_PORT = 9889)
## If no default is provided the return value is a string
get_opts("port")
## Provide a default to hint at the options type
get_opts("port", 8080L)
Sys.setenv(PLUMBER2_PORT = old_env)
Run the code above in your browser using DataLab