Skip to content

ADR 5: Environment

Context

Different components of the system need to access configuration properties and processing state, for example output directory, development or production mode, student or lecturer mode, etc.

It is unpractical to pass all these configuration explicitly through the processing pipeline.

Decision

We decided to use global environment object for storing the configuration and processing parameters. The environment has following properties

  • output_dir – current output directory
  • lecturer_modeTrue if generated version is intended for lecturer
  • development_modeTrue if local author-only version is generated
  • config – dictionary with all course configuration values

Course configuration is first populated with the default configuration and then updated with values from configuration file.

Processing state properties may be changed between the generation runs. For example all course pages are generated twice – for student and for lecturer. Between the runs, only output_dir and lecturer_mode properties are changed.

Status

Accepted.

Consequences

All components that need to know current processing mode or value of some configuration variable can request it directly from the environment. The environment can be used to change generation process.

The use of global variable introduces an implicit dependency that can be hard to trace.