Best Practise for Passing DB Creds to an RConnect or Shiny App?

What's the best way to pass credentials (for a database connection) to a Shiny or Connect app in RConnect? Obviously we don't want to hard-code them, but we're having problems reading from any environment files - I assume this is due to the way Connect packages and publishes?

Any ideas?

thanx,

Russell

So to answer my own question, it looks like using https://github.com/rstudio/config is the best idea :slight_smile:

--Russell

Your options include using a config file, but please be careful with this, since it would typically also mean that your config file is under version control, and thus your passwords could leak.

You general options for securing credentials are described in the article Securing Credentials at https://db.rstudio.com/

Possibly the best of these options is to encode the passwords in a DSN on your Connect server.

Failing that, I would suggest putting the passwords in the Vars tabs in your Connect admin panel for the app, as described at https://docs.rstudio.com/connect/user/content-settings/#content-vars

1 Like