Skip to content

Configuration

Chiara Di Pietro edited this page Apr 5, 2020 · 6 revisions

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

  • 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

Configurations is defined as a AppConfig provider and is injected into main app module. It is loaded during app initialization, to that it will be immediately available for every component. The three groups are gathered (although 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;
    }
}