Skip to content

Instantly share code, notes, and snippets.

@bfatemi
Created September 18, 2019 23:14
Show Gist options
  • Save bfatemi/e3d1a4961a36d9525681f0a8a79599c9 to your computer and use it in GitHub Desktop.
Save bfatemi/e3d1a4961a36d9525681f0a8a79599c9 to your computer and use it in GitHub Desktop.
shiny app to explore current session user and more
library(shiny)
library(lubridate)
library(sodium)
library(jsonlite)
ui <- fluidPage(
titlePanel("Explore Session Meta"),
sidebarLayout(
NULL,
mainPanel(
fluidPage(
fluidRow(
helpText("Session user info"),
verbatimTextOutput("curr_auth")
),
fluidRow(
helpText("Environment Var Lookup Panel"),
inputPanel(
textInput(
inputId = "env_var_name",
label = NULL,
placeholder = "env name"
),
verbatimTextOutput("env_var_value")
)
)
)
)
)
)
server <- shinyServer(function(input, output, session) {
r_auth_ll <- reactive({
usr <- session$user
grp <- session$groups
list(username = usr, groups = grp)
})
output$curr_auth <- renderText(jsonlite::prettify(jsonlite::toJSON(r_auth_ll())))
output$env_var_value <- renderText(Sys.getenv(x = input$env_var_name, "NA"))
})
shinyApp(ui = ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment