diff --git a/.github/workflows/mariadb-connection.yml b/.github/workflows/mariadb-connection.yml index 7204250..8655bfe 100644 --- a/.github/workflows/mariadb-connection.yml +++ b/.github/workflows/mariadb-connection.yml @@ -1,6 +1,6 @@ on: push: - branches: [test] + branches: [arg-pkg] name: MariaDB-Connection @@ -13,7 +13,6 @@ jobs: host port: 3306 # Optional, default value is 3306. The port of host container port: 3306 # Optional, default value is 3306. The port of container character set server: 'utf8' # Optional, default value is 'utf8mb4'. The '--character-set-server' option for mysqld - mysql root password: ${{ secrets.MARIADB_PW }} # Required if "mysql user" is empty, default is empty. The root superuser password mysql user: ${{ secrets.MARIADB_USR }} # Required if "mysql root password" is empty, default is empty. The superuser for the specified database. Can use secrets, too mysql password: ${{ secrets.MARIADB_PW }} # Required if "mysql user" exists. The password for the "mysql user" - \ No newline at end of file + \ No newline at end of file diff --git a/R/global.R b/R/global.R index 537640c..8470962 100644 --- a/R/global.R +++ b/R/global.R @@ -22,6 +22,3 @@ sample_cred <- data.frame( permissions = c("admin", "standard"), stringsAsFactors = F ) - -tryCatch({mariadb_connect()}, error = function(e) print(e)) -credentials <- tryCatch({mariadb_connect()}, error = function(e) return (sample_cred)) diff --git a/R/mariadb_connect.R b/R/mariadb_connect.R index 5252d0a..3351620 100644 --- a/R/mariadb_connect.R +++ b/R/mariadb_connect.R @@ -35,4 +35,5 @@ mariadb_connect <- function(..., } - +conn <- dbConnect(RMariaDB::MariaDB(), user="behnam", password="111111", + dbname="test_db", host="localhost", port="3306") diff --git a/R/server.R b/R/server.R index 2c81872..17ceb13 100644 --- a/R/server.R +++ b/R/server.R @@ -32,10 +32,23 @@ server <- function(input, output, session) { if (input$login > 0) { Username <- isolate(input$userName) Password <- isolate(input$passwd) + db <- suppressWarnings(system("printenv MARIADB_DB", intern = T)) + usr <- suppressWarnings(system("printenv MARIADB_USR", intern = T)) + tbl <- suppressWarnings(system("printenv MARIADB_TBL", intern = T)) + pass <- suppressWarnings(system("printenv MARIADB_PW", intern = T)) + host <- suppressWarnings(system("printenv MARIADB_HOST", intern = T)) + port <- suppressWarnings(system("printenv MARIADB_PORT", intern = T)) + + tryCatch({conn <- dbConnect(RMariaDB::MariaDB(), user=usr, password=pass, + dbname=db, host= host, port=port)}, error=function(e) print(e)) + + credentials <- tryCatch({mariadb_connect()}, error = function(e) return (sample_cred)) + if(length(which(credentials$username_id==Username))==1) { pasmatch <- credentials["passod"][which(credentials$username_id==Username),] pasverify <- password_verify(pasmatch, Password) if(pasverify) { + rm(credentials) USER$login <- TRUE } else { shinyjs::toggle(id = "nomatch", anim = TRUE, time = 1, animType = "fade") diff --git a/README.md b/README.md index 38ee7fb..c27625a 100644 --- a/README.md +++ b/README.md @@ -2,21 +2,18 @@ # PRIMACE Prediction Tool - [![PRIMACE](man/figures/webapp.svg)](https://primace.aikadeh.com) -[![Continuous-Deployment](https://github.com/hedayatbehnam/primace/workflows/Continuous-Deployment/badge.svg)](https://github.com/hedayatbehnam/primace/actions) -[![Docker-Build-Push](https://github.com/hedayatbehnam/primace/workflows/Docker-Build-Push/badge.svg)](https://github.com/hedayatbehnam/primace/actions) -[![R-CMD-Check](https://github.com/hedayatbehnam/primace/workflows/R-CMD-Check/badge.svg)](https://github.com/hedayatbehnam/primace/actions) -[![S3-Bucket-Connection](https://github.com/hedayatbehnam/primace/workflows/S3-Bucket-Connection/badge.svg)](https://github.com/hedayatbehnam/primace/actions) -[![Data-Modification-Check](https://github.com/hedayatbehnam/primace/workflows/Data-Modification-Check/badge.svg)](https://github.com/hedayatbehnam/primace/actions) -[![Webapp-Availability](https://github.com/hedayatbehnam/primace/workflows/Webapp-Availability/badge.svg)](https://github.com/hedayatbehnam/primace/actions) + +[![Continuous-Deployment](https://github.com/hedayatbehnam/primace/workflows/Continuous-Deployment/badge.svg)](https://github.com/hedayatbehnam/primace/actions) [![Docker-Build-Push](https://github.com/hedayatbehnam/primace/workflows/Docker-Build-Push/badge.svg)](https://github.com/hedayatbehnam/primace/actions) +[![R-CMD-Check](https://github.com/hedayatbehnam/primace/workflows/R-CMD-Check/badge.svg)](https://github.com/hedayatbehnam/primace/actions) [![S3-Bucket-Connection](https://github.com/hedayatbehnam/primace/workflows/S3-Bucket-Connection/badge.svg)](https://github.com/hedayatbehnam/primace/actions) +[![Data-Modification-Check](https://github.com/hedayatbehnam/primace/workflows/Data-Modification-Check/badge.svg)](https://github.com/hedayatbehnam/primace/actions) [![Webapp-Availability](https://github.com/hedayatbehnam/primace/workflows/Webapp-Availability/badge.svg)](https://github.com/hedayatbehnam/primace/actions) [![GitHub issues](https://img.shields.io/github/issues/hedayatbehnam/primace?color=blue&logo=github)](https://github.com/hedayatbehnam/primace/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/hedayatbehnam/primace?color=blue&logo=github)](https://github.com/hedayatbehnam/primace/pulls) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/hedayatbehnam/primace/blob/main/LICENSE.md) -[![Lifecycle:Experimental](https://img.shields.io/badge/Lifecycle-Experimental-339999)]() + -## Overview +# Overview `PRIMACE` is a shinyapp web application based on R language shiny package which can be used to predict major cardiovascular events (MACE) in first year following Primary Percutaneous Coronary Intervention (PPCI) **PPCI:** Primary Percutaneous Coronary Intervention **MACE:** Major Adverse Cardiovascular Events