Skip to content

Fall back to sys env var if R option doesn't exist#934

Merged
schloerke merged 4 commits intorstudio:mainfrom
meztez:env_options
Nov 27, 2023
Merged

Fall back to sys env var if R option doesn't exist#934
schloerke merged 4 commits intorstudio:mainfrom
meztez:env_options

Conversation

@meztez
Copy link
Collaborator

@meztez meztez commented Nov 25, 2023

…umber`.

PR task list:

  • Update NEWS
  • Add tests
  • Update documentation with devtools::document()

Setting an option that requires a function using an environment variable with most likely fail. Environment variable are characters.

Comment on lines +105 to +111
default
} else {
if (res %in% c("TRUE", "FALSE")) {
return(as.logical(res))
}
res
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cosmetic

Suggested change
default
} else {
if (res %in% c("TRUE", "FALSE")) {
return(as.logical(res))
}
res
}
return(default)
}
if (res %in% c("TRUE", "FALSE")) {
return(as.logical(res))
}
res

@meztez
Copy link
Collaborator Author

meztez commented Nov 27, 2023

I'm investigating using package options as @gadenbuie suggested. I'll do a second PR, we can work from there to choose which one makes the most sense.

@schloerke
Copy link
Collaborator

I'll do a second PR, we can work from there to choose which one makes the most sense.

Yes, it looks promising! https://dgkf.github.io/options/articles/options.html

We could probably soft deprecate options_plumber() (as it was mainly a place for documentation for all options) or just have options_plumber() use options::opt/options::opts internally. We could then mark options_plumber as @keywords internal (and drop from other docs) to favor the {options} package usage.

@schloerke schloerke changed the title Allow to set plumber options using environment variables `?options_pl… Fall back to sys env var if R option doesn't exist Nov 27, 2023
@schloerke schloerke merged commit aa627ac into rstudio:main Nov 27, 2023
schloerke added a commit that referenced this pull request Feb 5, 2025
* main: (28 commits)
  feat: add `excel` serializer/parser (#975)
  ci: Error on spelling (#981)
  docs: Improve forward docs a bit (#978)
  Fix file path tests on windows (#979)
  bug: Update default debug behaviour to `FALSE` (#976)
  perf: Avoid disk I/O during parsing (#972)
  docs: Add note on annotating required parameters (#971)
  Allows port to be specified as an environment variable (#963)
  tests: Replace `with_mock()` with `with_mocked_bindings()` (#970)
  feat(serializer): Add support for ragg and svglite (#964)
  chore: Fix pkgdown warnings. Use lifecycle inline R badges (#965)
  v1.2.2 release candidate (#948)
  bug: Use `{rlang}` instead of `{ellipsis}` (#958)
  docs: Update URLs (#954)
  docs: fix table spacing (#951)
  docs: change link to httr2 in routing and input vignette (#944)
  Specify interactive mode in doc (#932)
  Fall back to sys env var if R option doesn't exist (#934)
  Add support for quoted boundary for multipart request parsing. (#924)
  chore: Remove parse comment to match implementation (#931)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants