Skip to contents

Setup the global survey environment by creating database connections, environment variables, and a future asynchronous processing plan. Validates database configuration, sets environment variables if needed, configures Shiny settings, establishes a database connection pool, and initializes a future plan.

Usage

survey_setup(db_config, shiny_config = NULL)

Arguments

db_config

List. Database configuration parameters:

  • host: Database host address

  • port: Database port number

  • db_name: Name of the database

  • user: Database username

  • password: Database password

  • write_table: Table name for write operations

shiny_config

List. Optional Shiny configuration parameters to pass to configure_shiny(). Applied before database initialization.

Value

Invisibly returns the initialized database pool object

Details

The function:

  • Validates write_table is non-empty

  • Checks required database fields

  • Sets environment variables if missing (HOST, PORT, DB_NAME, USER, PASSWORD)

  • Applies optional Shiny settings

  • Creates global database pool if needed

The database pool is stored globally as 'app_pool' and reused if it exists. Environment variables are only set if not already present.