Skip to content

Commit

Permalink
fix: try again maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyaZar committed Feb 24, 2024
1 parent f375645 commit e057238
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion deploy.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,29 @@ set_env_deploy <- function() {
Sys.setenv("APP_NAME" = Sys.getenv(env_var_name))
}
#
Sys.setenv("GOLEM_MAINTENANCE_ACTIVE" = TRUE)
set_golem_maintenance <- function(MAINTENANCE = FALSE) {
stopifnot(`Value for arg. 'MAINTENANCE' must be logical` =
is.logical(MAINTENANCE))
write_renviron_maintenance(MAINTENANCE)
}
write_renviron_maintenance <- function(VAL, fn_name = ".Renviron") {
STATE_TO_WRITE <- paste0("GOLEM_MAINTENANCE_ACTIVE=", VAL)
if (file.exists(fn_name)) {
tmp_file <- readLines(fn_name)
check_SET_GMA <- grepl("GOLEM_MAINTENANCE_ACTIVE", tmp_file)
if (any(check_SET_GMA)) {
tmp_file[check_SET_GMA] <- STATE_TO_WRITE
} else {
tmp_file <- c(tmp_file, STATE_TO_WRITE)
}
writeLines(tmp_file, fn_name)
} else {
writeLines(STATE_TO_WRITE, fn_name)
}
return(invisible(NULL))
}
#
set_golem_maintenance(TRUE)
# Authenticate
rsconnect::setAccountInfo(
name = error_on_missing_name("SHINY_ACC_NAME"),
Expand Down

0 comments on commit e057238

Please sign in to comment.