Database path in dev and production #708
-
For my
Thereafter I am defining a function in
While this works, is it the right way to define the path? In I am also thinking perhaps making an entry like this in the Dockerfile would work? And thanks again for making such a terrific package! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey @pythiantech, Side note before answering: thanks for the positive feedback 🤘. That always means a lot to us. Side note two: as of golem v0.3.1, you can use the
As you can see, the behavior is the following one: # default
get_golem_config(
"MONGODBURL"
)
[1] "localhost"
# Changing the config ENV_VAR
Sys.setenv("GOLEM_CONFIG_ACTIVE" = "production")
get_golem_config(
"MONGODBURL"
)
[1] "0.0.0.0" A full example of a working app playing with 1.5 side note, you should define the Pool inside another function, so that the pool can be created at runtime, something like : make_pool <- function(){
pool::dbPool(
drv = RSQLite::SQLite(),
dbname = get_golem_config('dbpath')
)
} Then in app_server : app_serve <- function(){
pool <- make_pool()
} That way, the pool will be created at runtime not when compiling the package.
Cheers, |
Beta Was this translation helpful? Give feedback.
-
Hello @ColinFay, I finally got access to the production server and was hence able to test my Docker image. Unfortunately it fails as the
However, with this, the default configuration gets picked up and not the production which is defined as follows in
The workaround that I am using currently (and I think is quite sloppy) is to have Can you please tell me what am I doing wrong here? |
Beta Was this translation helpful? Give feedback.
Hey @pythiantech,
Side note before answering: thanks for the positive feedback 🤘. That always means a lot to us.
Side note two: as of golem v0.3.1, you can use the
GOLEM_CONFIG_ACTIVE
env var if you really want to focus on using thegolem-config
file, without conflicting with potential{config}
elements (notably on RStudio Connect).As you can see, the behavior is the following one: