[Shiny Manager] Preserve user information on server restart

Hello!
I've created a shiny app, using shiny manager for authentication, currently hosted using shiny server. I'm using encrypted sqlite file for credentials as documented in shiny manager documentation. The app runs prefectly and administrator mode performs well as it should.

But the problem is, whenever the server is restarted, all the users created using administrator mode gets erased and the app starts fresh.

My code is like this:

# ui.R
ui <- secure_app(
   enable_admin = TRUE,
   # Rest of ui codes
)

# server.R
server <- function(input, output, session){
   result_auth <- secure_server(
       check_credentials = check_credentials(
         "credentials/credentials.sqlite",
         passphrase = key_get("credentialskey", "astrongpassword")
       )
  )

   output$auth_output  <- renderPrint({
		reactiveValuesToList(result_auth)
	})

# Rest of server codes
}

# global.R
library(shiny)
library(shinymanager)
library(keyring)

# some predefined users
credentials <- data.frame(
  user = c("user", "admin"),
  password = c("12345", "admin"),
  admin = c(FALSE, TRUE),
  stringsAsFactors = FALSE
)

key_set("credentialskey", "astrongpassword")

create_db(
  credentials_data = credentials,
  sqlite_path = "credentials/credentials.sqlite", # will be created
  passphrase = key_get("credentialskey", "astrongpassword")
)

# Rest of global codes

How can I preserve the credentials so that whenever the server is restarted, the credentials are restored?

Thanks in advance.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.