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?



So to answer my own question, it looks like using is the best idea :slight_smile:


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

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

1 Like