#' @title Set Prosha database connection
#' @description The command setup connection with any DTwin databases based on Prosha (alias for city DB)
#' @param dbname A string value with database name inside Prosha, like "munstat2"
#' @usage set_conn_prosha(dbname)
#' @return object with connection
#' @importFrom dplyr %>%
#' @importFrom DBI dbCanConnect
#' @importFrom dplyr %>%
#' @importFrom RPostgres Postgres
#' @export
#' @examples
#' set_conn_prosha() # call to munstat2 db
#' set_conn_prosha("dwh_prod") # call to specific db on Prosha
#'
set_conn_prosha <- function (dbname = "munstat2") {
host = "192.168.1.11"
port = 5432
user = "postgres2"
password = "FEOfan2020@"
host <- ifelse(DBI::dbCanConnect (RPostgres::Postgres(),
host = "192.168.1.11", port = port,
dbname = dbname, #база хранилища
user = "postgres2",
password = "FEOfan2020@")[1], "192.168.1.11", "81.3.154.168")
conn <- DBI::dbConnect(RPostgres::Postgres(),
host = host, port = port,
dbname = dbname, #база хранилища
user = "postgres2",
password = "FEOfan2020@")
return (conn)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.