Skip to content

Configuration

Roberto Rosselli Del Turco edited this page Apr 10, 2020 · 6 revisions

There are several configuration options, ranging from setting the folders where edition data is stored to choosing the User Interface layout and the tools to be made available for the final user, that can be set by editing the configuration files in the assets/config directory. To facilitate the configuration work, configuration options are divided into three macro groups:

  • Edition Configuration (edition_config.json), where to set the configurations closely related to the digital edition, such as the title, the edition level(s), etc. See details here.
  • File Configuration (file_config.json), where to set the path(s) to the file(s) of the digital edition. See details here.
  • UI Configuration (ui_config.json), where to set the configuration closely related to the UI, such as the default language, the default/available theme(s), etc. See details here.

Technical details for development

Configuration is defined as a AppConfig provider and is injected into the main app module. It is loaded during app initialization, so that it will be immediately available for every component. The three groups are gathered (although they will be kept divided) in a single EVTConfig object.

interface EVTConfig {
    ui: UiConfig;
    edition: EditionConfig;
    files: FileConfig;
}

If you want to use a parameter from configuration in your component, you just need to import AppConfig and directly use its properties:

import { AppConfig } from '../app.config';
@Component({
  selector: 'my-component',
  templateUrl: './my-component.component.html',
  styleUrls: ['./my-component.component.scss']
})
export class MyComponent {
    private editionTitle: string;
    constructor() {
        this.editionTitle = AppConfig.evtSettings.edition.title;
    }
}