Skip to content

Commit a8c0251

Browse files
committed
MONGO_USER and MONGO_PASSWORD added
1 parent 02138eb commit a8c0251

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: BioDataScience
22
Type: Package
3-
Version: 2020.0.9000
3+
Version: 2020.0.9001
44
Title: A Series of Learnr Documents for Biological Data Science
55
Description: Interactive documents using learnr for studying biological data science.
66
Authors@R: c(

NEWS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# BioDataScience News
1+
# BioDataScience 2020.0.9001
22

3-
## Changes in version 2020.0.9000
3+
- Separate `MONGO_SER` and `MONGO_PASSWORD` variables in `init()` and do not set them if already there.
4+
5+
# BioDataScience 2020.0.9000
46

57
- In `record_sdd()`, date is now recorded in GMT timezone and with microseconds.
68
- An `init()` function is added to set globally `MONGO_URL` and `MONGO_BASE`

R/init.R

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#' Initialize the environment for our BioDataScience courses
22
#'
3+
#' This function creates several environment variables that are widely used by
4+
#' other packages and applications. Currently, `MONGO_URL`, `MONGO_BASE`,
5+
#' `MONGO_USER` and `MONGO_PASSWORD` are set to default values if not already
6+
#' there.
7+
#'
38
#' @return Nothing, the function is used for its side-effect of creating global
49
#' variables.
510
#' @export
@@ -12,8 +17,14 @@
1217
#' Sys.getenv("MONGO_BASE")
1318
init <- function() {
1419
# Set variable environment required to locate our sdd MongoDB database
15-
Sys.setenv(MONGO_URL = "mongodb://sdd:sdd@sdd-umons-shard-00-00-umnnw.mongodb.net:27017,sdd-umons-shard-00-01-umnnw.mongodb.net:27017,sdd-umons-shard-00-02-umnnw.mongodb.net:27017/test?ssl=true&replicaSet=sdd-umons-shard-0&authSource=admin")
16-
Sys.setenv(MONGO_BASE = "sdd")
20+
if (Sys.getenv("MONGO_URL") == "")
21+
Sys.setenv(MONGO_URL = "mongodb://{user}:{password}@sdd-umons-shard-00-00-umnnw.mongodb.net:27017,sdd-umons-shard-00-01-umnnw.mongodb.net:27017,sdd-umons-shard-00-02-umnnw.mongodb.net:27017/test?ssl=true&replicaSet=sdd-umons-shard-0&authSource=admin")
22+
if (Sys.getenv("MONGO_BASE") == "")
23+
Sys.setenv(MONGO_BASE = "sdd")
24+
if (Sys.getenv("MONGO_USER") == "")
25+
Sys.setenv(MONGO_USER = "sdd")
26+
if (Sys.getenv("MONGO_PASSWORD") == "")
27+
Sys.setenv(MONGO_PASSWORD = "sdd")
1728
# ... other global stuff to do here...
1829
return()
1930
}

man/init.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)