Config & Constants

This page documents the config and constants providers in the backend. These modules allow the rest of the application to access instance-specific values.

The constants are only constant across an executing program. They are not constant across all program instances.

Config

This module contains our configuration. The configuration is stored in the database, as an untyped (all strings) set of key/value pairs.

All exposed functions besides initialize_config and write_default_config fetch a configuration value from the database.

src.config.index_crontab_str()

A crontab representing when to index the library.

Return type

str

src.config.initialize_config()

Write the default config if a config file doesn’t exist. And if the existing config lacks keys, update it with new default values.

Return type

None

src.config.music_directories()

The directories to scan when indexing the library.

Return type

list[str]

src.config.set_index_crontab(value, conn)
Raises

InvalidConfig – If the crontab is syntactically invalid.

Return type

None

src.config.set_music_directories(dirs, conn)
Raises

InvalidConfig – If any directories don’t exist.

Return type

None

Constants