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.

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

Value

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

Details

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

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:

dbreference:
  ...
  password: !aws_kms |
    ciphertext

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

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.

Note

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