Attempting to use options package.#936
Conversation
|
I'm thinking using the options package would maybe open up an attack vector, because of this line here: I'm going to ice this one for now. |
|
@meztez Currently, |
|
The So we could use a helper function to define the options (setting the # Copied from https://github.com/dgkf/options/blob/a2c1102/R/envvars.R#L1-L4
# Sets up pretty printing
fn_with_desc <- function(f, desc) {
attr(f, "desc") <- desc
f
}
# Keep sys env var as raw string only
plumber_envvar_raw <- fn_with_desc(
function(raw, name, ...) {
raw
},
"string"
)
define_plumber_option <- function(...) {
options::define_option(
...,
envvar_fn = plumber_envvar_raw
)
}# Ex usage
define_plumber_option(
option = "port",
default = NULL,
desc = paste(
"Port Plumber will attempt to use to start http server.",
"If the port is already in use, server will not be able to start."
)
) |
|
Noted, still have to figure out what to do with options_plumber, return values. Probably do not want to change the behavior. Options does not have an |
Pending a doc ordering issue in options package.
dgkf/options#7
PR task list:
devtools::document()