Skip to content

Configuration files

haskelt edited this page Feb 1, 2022 · 10 revisions

Salal is designed to make it easy for you to customize its behavior for your particular use cases. One way this can be done is with configuration files.

Structure of configuration files

Configuration files should be in JSON format, and have two main sections, which are both optional:

  • Globals
  • Parameters

Globals are values that can be substituted into source files. For example, this config file defines a global variable special_style_file.

{
    "globals": { 
        "special_style_file": "/css/style_for_sally.css"
    }
}

This value can then be referenced in a template like this:

<link rel="stylesheet" href="{{globals.special_style_file}}" type="text/css" />

Parameters change how Salal operates. For example, the paths subsection under parameters tells Salal where to look for various files. In the example below, we specify where to look for the user config file (the different kinds of config files are explained more below).

{
    "parameters": {
        "paths": {
            "user_config_file": "~/.salal/user_config.json"
        }
    }
}

Kinds of configuration files

When you run Salal, it will look for 5 different configuration files:

  • System
  • User
  • Theme
  • Project
  • Profile

Only the system config file is required. These configuration files all have the same format, and are processed in the order shown above. A file lower in the list can add new globals or parameters, or override ones that were set in a config file earlier in the sequence.

User configuration

Default location: ~/.salal/user_config.json

This is useful when you have particular kinds of configuration that you use for many projects, and want to avoid putting the same information in every project config file.

Theme configuration

Default location: <theme_dir>/config/theme_config.json

Themes are useful when you have templates, code, CSS, etc. that you use for multiple related projects. You can learn more on the Themes page. You can tell Salal you want to use a theme by providing the path to the theme directory, like this:

{
    "parameters": {
        "paths": {
            "theme_root": "~/salal_themes/app_theme"
        }
    }
}

It is typical to specify a theme in the project config file. Note that in this case the theme configuration will still get applied before the project configuration.

Project configuration

Default location: <project_dir>/config/project_config.json

The project config file is useful for any globals or parameters that are specific to a particular project.

Clone this wiki locally