diff --git a/R/common/environment.R b/R/common/environment.R new file mode 100644 index 0000000..9cd5c86 --- /dev/null +++ b/R/common/environment.R @@ -0,0 +1,36 @@ +environnement <- "prod" +#environnement <- "recette" +#environnement <- "local" + +if(environnement == "prod"){ + server_path <- "https://tomcat.herdbookcharolais.com/HbcSchedulerAndServices-2.0-SNAPSHOT/" + + infos_con <- list( + drv = RPostgres::Postgres(), + dbname = "hbc", + host = "10.1.225.66", + user = "client_prod", + password = "vYl9Z^@k9rGTTOG~T1rR" + ) +} else if(environnement == "recette"){ + server_path <- "https://recette.tomcat.racecharolaise.fr/HbcSchedulerAndServices-2.0-SNAPSHOT/" + + infos_con <- list( + drv = RPostgres::Postgres(), + dbname = "hbc-R7", + host = "10.1.234.197", + user = "client_recette", + password = "3J3d7nbZ7E4neP" + ) + +} else { + server_path <- "http://localhost:8080/HbcSchedulerAndServices/" + + infos_con <- list( + drv = RPostgres::Postgres(), + dbname = "hbc-R7", + host = "10.1.234.197", + user = "client_recette", + password = "3J3d7nbZ7E4neP" + ) +} \ No newline at end of file diff --git a/R/common/ws_client.R b/R/common/ws_client.R index 07ac501..428258d 100755 --- a/R/common/ws_client.R +++ b/R/common/ws_client.R @@ -5,44 +5,7 @@ suppressPackageStartupMessages({ library(tidyverse) }) source(here::here("R/common/prepare_data.R")) - -environnement <- "prod" -#environnement <- "recette" -#environnement <- "local" - -if(environnement == "prod"){ - server_path <- "https://tomcat.herdbookcharolais.com/HbcSchedulerAndServices-2.0-SNAPSHOT/" - - infos_con <- list( - drv = RPostgres::Postgres(), - dbname = "hbc", - host = "10.1.225.66", - user = "client_prod", - password = "vYl9Z^@k9rGTTOG~T1rR" - ) -} else if(environnement == "recette"){ - server_path <- "https://recette.tomcat.racecharolaise.fr/HbcSchedulerAndServices-2.0-SNAPSHOT/" - - infos_con <- list( - drv = RPostgres::Postgres(), - dbname = "hbc-R7", - host = "10.1.234.197", - user = "client_recette", - password = "3J3d7nbZ7E4neP" - ) - -} else { - server_path <- "http://localhost:8080/HbcSchedulerAndServices/" - - infos_con <- list( - drv = RPostgres::Postgres(), - dbname = "hbc-R7", - host = "10.1.234.197", - user = "client_recette", - password = "3J3d7nbZ7E4neP" - ) -} - +source(here::here("R/common/environment.R")) #' Fonction d'appel des webservices http_get <- function(url, method = "GET", params = NULL, headers = NULL, auth = NULL, timeout_sec = 500) {