Replies: 1 comment 1 reply
-
Hey @kyleweise, Thanks for your question :)
So basically, given the following yaml: default:
db: defaultdb
production:
db: abcd
dev:
db: xyz Here is how it works: # No envvar, returning the default
> get_golem_config("db")
[1] "defaultdb"
# With "production" `GOLEM_CONFIG_ACTIVE`
> Sys.setenv("GOLEM_CONFIG_ACTIVE" = "production")
> get_golem_config("db")
[1] "abcd"
> Sys.setenv("GOLEM_CONFIG_ACTIVE" = "dev")
> get_golem_config("db")
[1] "xyz" In your usecase, if you add Let me know, |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey @ColinFay and golem team,
I have a question I hope is pretty straightforward. Even after reading this, I'm still a bit confused on options as they pertain to golem shiny applications.
Basically, I have two databases, Development and Production. When I am testing/developing an app locally, I'd like to use the Development credentials, and similarly when the app is hosted on RSConnect, I'd like to use the Production credentials.
For Development, I store credentials in a
.Renivron
file, for Production I store credentials in RSConnect environment variables. In both cases, I use the!expr Sys.getenv("[option_name]")
syntax ingolem_config.yml
to get the value.I am curious as to how I would go about allowing my app to be run in both DEV and PROD modes, locally. Basically, allow me to "turn a switch" so that I can connect to Production to see what the app looks like before I actually deploy it to RSConnect. In my
golem_utils_server.R
file, I have the following:and the
golem_config.yml
looks likeI tried setting:
options(golem.app.prod = T)
, but I'm still seeing "Connected to Development DB" when I run the app. How can I makegolem::app_prod()
returnTRUE
?Thanks so much! And again, amazing package!
-Kyle
Beta Was this translation helpful? Give feedback.
All reactions