setup_config: Load episomer application settings

View source: R/config.R

setup_configR Documentation

Load episomer application settings

Description

Load episomer application settings from the designated data directory

Usage

setup_config(
  data_dir = default_data_dir(),
  ignore_keyring = FALSE,
  ignore_properties = FALSE,
  ignore_topics = FALSE,
  save_properties_first = FALSE,
  save_topics_first = list(),
  fs_remote = if (Sys.getenv("EPI_HOST") != "") {
     Sys.getenv("EPI_HOST")
 } else {
 
       "http://localhost:8080"
 }
)

Arguments

data_dir

Path to the directory containing the application settings (it must exist). If not provided it takes the value of the latest call to setup_config in the current session, or the value of the EPI_HOME environment variable or episomer subdirectory in the working directory, default: default_data_dir(), i.e. conf$data_dir, then the EPI_HOME environment variable, then file.path(tempdir(), "episomer")

ignore_keyring

Whether to skip loading settings from the keyring (social media and SMTP credentials), default: FALSE

ignore_properties

Whether to skip loading settings managed by the Shiny app in properties.json file, Default: FALSE

ignore_topics

Whether to skip loading settings defined in the topics.xlsx file and download plans from topics.json file, default: FALSE

save_properties_first

Whether to save current settings before loading new ones from disk, default: FALSE

save_topics_first

List of social media to save its topics to disk before loading new ones from disk, default: list()

fs_remote

address of the central instance of episomer for accessing

Details

episomer relies on settings and data stored in a system folder, so before loading the dashboard, collecting posts or detecting alerts the user has to designate this folder. When a user wants to use episomer from the R console they will need to call this function for initialisation. The 'data_folder' can also be given as a parameter for program launch functions episomer_app, search_loop or detect_loop, which will internally call this function.

This call will fill (or refresh) a package scoped environment 'conf' that will store the settings. Settings stored in conf are:

  • General properties of the Shiny app (stored in properties.json)

  • Download plans from the social media collection process (stored in topics.json merged with data from the topics.xlsx file

  • Credentials for social media APIs and SMTP stored in the defined keyring

  • The identity of the running instance: 'instance_id', a random identifier generated once per R process, and 'instance_host', the name of the machine. Both describe the current process rather than the shared configuration, so they are never written to properties.json. 'instance_host' is taken from the environment variable 'EPISOMER_INSTANCE' when it is set, and falls back to the system host name otherwise. Setting 'EPISOMER_INSTANCE' is recommended when running episomer in containers, whose host names are random, and when several machines share the same data directory: it is the name the dashboard displays to tell which machine a service is running on.

When calling this function and the keyring is locked, a password will be prompted to unlock the keyring. This behaviour can be changed by setting the environment variable 'ecdc_social_tool_kr_password' with the password.

Changes made to conf can be stored permanently (except for 'data_dir') using:

  • save_config, or

  • sm_api_set_auth_bluesky

  • sm_api_set_auth_mastodon

Value

Nothing

See Also

save_config sm_api_set_auth_bluesky sm_api_set_auth_mastodon episomer_app search_loop detect_loop

Examples

## Not run: 
   library(episomer)
   #loading system settings
   message('Please choose the episomer data directory')
   setup_config(file.choose())

## End(Not run)

episomer documentation built on Nov. 26, 2026, 5:07 p.m.