Skip to contents

Setup the server-side components of the survey application by setting up logging and database operations in the parent environment. Creates a new logger instance and attempts to establish database operations, with error handling for database initialization failures.

Usage

server_setup(session, db_config, app_pool, survey_logger, db_ops)

Arguments

session

A Shiny session object containing the session token

db_config

A list containing database configuration with elements:

  • log_table: Name of the logging table in the database

  • write_table: Name of the survey table in the database

app_pool

A database connection pool object from the global environment

survey_logger

A reference class object for logging functionality

db_ops

A reference class object for database operations

Details

This function creates two objects in the parent environment:

  • logger: The initialized survey logger object

  • db_ops: The initialized database operations object (or NULL if initialization failed)

Examples

if (FALSE) { # \dontrun{
server_setup(
  session = session,
  db_config = db_config,
  app_pool = app_pool,
  survey_logger = survey_logger,
  db_ops = db_ops
)
# After running, 'logger' and 'db_ops' are available in the parent environment
} # }