0

I have a working shinyproxy app with LDAP authentication. However, for retrieving data from the SQL-database I now use (not recommended) a hardcoded connection string in my R code with the credentials mentioned herein (I use a service user because my end users don't have permissions to query the database):

con <- DBI::dbConnect(odbc::odbc(),
                      encoding = "latin1",
                      .connection_string = 'Driver={Driver};Server=Server;Database=dbb;UID=UID;PWD=PWD') 

I tried to replace the connection string with an environmental variable, that I pass from my Linux host to the container. This works when running the container outside ShinyProxy, and thus by passing the environmental variables at runtime with the following Docker command:

docker run -it --env-file env.list app123

However, when using ShinyProxy, it is not clear to me how to configure this in the yaml config file. How do I pass the statement --env-file env.list at this level so that it is picked up in the linked containers?

Any help kindly appreciated!

bathyscapher
  • 1,615
  • 1
  • 13
  • 18
Bertusian
  • 27
  • 5

1 Answers1

3

From this closed issue: https://github.com/openanalytics/shinyproxy/issues/99

Your application.yaml could look something like this:

proxy:

  title: Open Analytics Shiny Proxy
  logo-url: http://www.openanalytics.eu/sites/www.openanalytics.eu/themes/oa/logo.png
  landing-page: /
  heartbeat-rate: 10000
  heartbeat-timeout: 60000
  port: 8080
  authentication: simple
  admin-groups: admin
  # Example: 'simple' authentication configuration
  users:
  - name: admin
    password: password
    groups: admin
  # Docker configuration
  docker:    
    internal-networking: true

  specs:
  - id: 01_hello
    display-name: Hello Application
    description: Application which demonstrates the basics of a Shiny app
    container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"]
    container-image: openanalytics/shinyproxy-demo
    container-env-file: /app/shinyproxy/test.env
    container-env:
       bar: baz
    access-groups: admin  
    container-network: shinyproxy_reprex_default  


logging:
  file:
    shinyproxy.log

Specifically it seems you could set environment variables with a file using container-env-file.

the-mad-statter
  • 5,650
  • 1
  • 10
  • 20