db_config: Load DB connection parameters

Description Usage Arguments Details Value Note

Description

Load DB connection parameters from a YAML file and optionally decrypt secrets via Amazon KMS or load values from Amazon System Manager's Parameter Store.

Usage

1
db_config(db, db_config_path = getOption("dbr.db_config_path"))

Arguments

db

database name reference

db_config_path

file path specified by the dbr.db_config_path global option as a string or function returning a string, which defaults to the db_config.yaml file in the current working directory

Details

The YAML file should include all connection parameters, including the Database Driver as an R object, see eg

1
2
3
4
5
6
dbreference:
  host: localhost
  port: 3306
  drv: !expr RMySQL::MySQL()
  username: foo
  password: bar

KMS-encrypted secrets should be specified with the aws_kms type in the YAML file, such as:

1
2
3
4
dbreference:
  ...
  password: !aws_kms |
    ciphertext

AWS Parameter Store values can be loaded by specifying the aws_parameter type in the YAML file, such as:

1
2
3
4
dbreference:
  ...
  password: !aws_parameter |
    /path/to/value

Fields that should not be passed to drv (eg extra params not used for making the DB connection) should be specified with the attr type that will be added as attributes to the returned list.

Value

list of database parameters (eg hostname, port, username, password etc)

Note

You need to install the botor package and also have access to the related KMS key to be able to decrypt cipher-text.


daroczig/dbr documentation built on June 12, 2020, 2:47 p.m.