Skip to content

Commit

Permalink
Merge branch 'master' into add_app_files
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewelamb committed Feb 3, 2020
2 parents e2ba0ef + 194e63e commit 8996762
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 1 deletion.
1 change: 1 addition & 0 deletions .Renviron.d/rstudio=FALSE/.Renviron
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ENV=prod
1 change: 1 addition & 0 deletions .Renviron.d/rstudio=TRUE/.Renviron
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ENV=dev
23 changes: 22 additions & 1 deletion .Rprofile
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
source("renv/activate.R")
try(source("renv/activate.R"))

cat("
--------------------------------------------------------------------------------
Welcome to the iAtlas Shiny App
--------------------------------------------------------------------------------
\n")

if (Sys.getenv("DOCKERBUILD") == "1") {
try(renv::restore())
try(startup::startup())
local({
options(shiny.port = 3838, shiny.host = "0.0.0.0")
})
} else if (length(find.package("devtools", quiet=T)) == 0 || length(find.package("renv", quiet=T)) == 0) {
# prompt instead since RStudio won't show progress for slow .RProfile scripts...
cat("TODO: Install package requirements. This may take up to an hour the first time.\n")
cat("RUN: source('./install.R')\n")
} else {
# auto-run since it should be quick, but makes sure any new requirements are installed.
source('./install.R')
}
5 changes: 5 additions & 0 deletions .Rprofile.d/ENV=dev.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB_NAME <- Sys.getenv("DB_NAME", unset = "iatlas_shiny_dev")
DB_HOST <- Sys.getenv("DB_HOST", unset = "localhost")
DB_PORT <- Sys.getenv("DB_PORT", unset = "5432")
DB_USER <- Sys.getenv("DB_USER", unset = "postgres")
DB_PW <- Sys.getenv("DB_PW", unset = "docker")
5 changes: 5 additions & 0 deletions .Rprofile.d/ENV=prod.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB_NAME <- Sys.getenv("DB_NAME", unset = "")
DB_HOST <- Sys.getenv("DB_HOST", unset = "")
DB_PORT <- Sys.getenv("DB_PORT", unset = "")
DB_USER <- Sys.getenv("DB_USER", unset = "")
DB_PW <- Sys.getenv("DB_PW", unset = "")
5 changes: 5 additions & 0 deletions .Rprofile.d/ENV=test.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB_NAME <- Sys.getenv("DB_NAME", unset = "iatlas_shiny_test")
DB_HOST <- Sys.getenv("DB_HOST", unset = "localhost")
DB_PORT <- Sys.getenv("DB_PORT", unset = "5432")
DB_USER <- Sys.getenv("DB_USER", unset = "postgres")
DB_PW <- Sys.getenv("DB_PW", unset = "docker")
3 changes: 3 additions & 0 deletions init.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
try(startup::startup())
cat(crayon::blue("SUCCESS: iatlas.app is ready to go.\n"))
cat(crayon::blue(paste0("RUN: ",crayon::bold("shiny::runApp()\n"))))
2 changes: 2 additions & 0 deletions install.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
renv::restore(confirm=FALSE)
source('./init.R')
7 changes: 7 additions & 0 deletions renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,13 @@
"Repository": "CRAN",
"Hash": "f27a078d834614513608da2c08031130"
},
"startup": {
"Package": "startup",
"Version": "0.14.0",
"Source": "Repository",
"Repository": "CRAN",
"Hash": "17a4b68eeeef4ab9f521caf9f16d1e86"
},
"stringi": {
"Package": "stringi",
"Version": "1.4.5",
Expand Down

0 comments on commit 8996762

Please sign in to comment.