Configuring the Magnolia Runtime

The configuration file is in YAML format and can contain the configuration settings documented below.

The file is named app.cfg and is searched for in the current working directory at application startup. Changes to this file will only become effective after a restart of the Magnolia runtime or after starting another application using the Start language command.

To help with machine specific configuration settings, an additional file named app-$STATIONID.cfg is read after the main configuration file. Note that merging of config settings happens on a per-section basis.

An example configuration file:

stdlib:
  db: user:password@dbserver.example.com/app
  log_file: app.log
  lang: en
serial:
  0:
    device: COM4
    baudrate: 19200
  1:
    device: /dev/ttyS1
    baudrate: 115200
printerclass:
  A: HPLJ4
printer:
  HPLJ4:
    functiontable: pcl5
    max_cols: 80
    max_rows: 70
    name: "HP LaserJet 4"
    queue: "hplj4"
printerfunction:
  pcl5:
    1: "\f"
    2: "\r\n"
    3: "\e(s6H\e(s10V"
    4: "\e(s10H\e(s10V"
    5: "\e(s3B"
    6: "\e(s0B"
    7: "\e&d1D"
    8: "\e&d@"
    9: "\e(s10H\e(s10V"
    10: "\e(s16.66H"
    11: "\e&l8C"
    12: "\e&l6C"
    13: "\e&l\xFF\x03P"
    14: "\e&a-35V"
    15: "\e&a+35V"
    16: "\e&a+25V"
    17: "\e&a-25V"
    18: "\eE"
    19: "\eE"
    20: "\b"
    21: "\e(s1S"
    22: "\e(s0S"
    23: "\e&l0O"
    24: "\e&l1O"
    30: "\e(s0P\e&k0s\e(s\x80"
    31: "\e(s0P\e&k4s\e(s\x80"
    32: "\e(s0P\e&k2s\e(s\x82"
    38: "\x0F"
    39: "\x0E"
    40: "\e(s4101T"
    41: "\e(s4143T"
    42: "\e(s4148T"
    43: C
    44: "\e(s1P\e(s10.00V"
    45: "\e(s1P\e(s11.00V"
    46: "\e(s1P\e(s12.00V"
    47: "\e(s1P\e(s14.00V"
    48: "\e(s1P\e(s16.00V"
    49: "\e(s1P\e(s20.00V"
    50: "\e(s1P\e(s24.00V"
    51: "\e(s1P\e(s28.00V"
    52: "\e(s1P\e(s36.00V"
    53: "\e(s1P\e(s48.00V"
    54: "\e(s1P\e(s60.00V"

stdlib.db

SQL Database access specification.

Format: user:password@host/dbname.

Default: none. Must be specified.

Type: string.

stdlib.lang

Language for messages the runtime will display to the user. Runtime will fall back to English messages, if the requested language is unavailable.

Valid values: en (for English) or another language code.

Default: en. English messages.

Example: de. German messages.

Type: string.

stdlib.ignore_sigint

Ignore CTRL-C during runtime.

Valid values: 0 (off) or 1 (on).

Default: 0 (off).

Type: bool.

stdlib.log_file

Specifies the path to the log file used by the runtime. Without log_file set, no logging will occur.

Default: none, logging disabled.

Type: string.

stdlib.auto_numlock

Specifies whether Num Lock should be automatically enabled for numeric fields.

Valid values: 0 (off) or 1 (on).

Default: 1 (on).

Type: bool.

stdlib.allow_system_keyboard_during_serial

Specifies whether input from the system keyboard should be accepted while the keyboard has been switched to use a serial port.

Valid values: 0 (off) or 1 (on).

Default: 0 (off).

Type: bool.

backends

Backends to use for platform specific functions.

backends.screen

Default on Windows: win32.

Valid values: win32, ncurses.

Type: string.

backends.print

Default on Windows: win32.

Valid values: win32, cups, file.

Type: string.

db.emulation

Dictionary for mapping DB filenames to DB Tablenames.

Key: Filename, with glob style matching.

db.emulation.<key>.name_format

Mapped table name including Schema name.

Format: <schema>.<table>

Replacement strings:

${stationid} Unsigned long “Station Id”. See The Station ID.
${username} Window logon username
${userid} Program-settable unsigned long “User Id”. Initial value is 0.

screen_win32.close_enabled

Optional configuration for backends.screen = win32.

Specified whether the Console System Menu “Close” command should be enabled (1) or disabled (0).

Valid values: 0 (menu disabled) or 1 (menu enabled).

Default: 1 (menu enabled).

serial

Dictionary with serial ports 0-3. More can be defined, but cannot be used from MLSYSTEM.210.

serial.<port>.<config>

<config> Type Description
device string Platform-specific device name
baudrate int Baudrate. Default: 9600.
parity char Parity: one of N, E, O, M, S. Default: N.
databits int Data bits: 5, 6, 7, 8. Default: 8.
stopbits int Stop bits: 1, 2. Default: 1.
flowcontrol string Flow control. Empty means no flow control, or one of xonxoff, rtscts, dsrdtr. Default: no flow control.

serial.<port>.device

Platform specific device name.

Format for Windows: COM<N>. Example: COM3.

May also refer to a socket://<host>:<port>/ or rfc2217://host>:<port>/ URL.

printerclass

Dictionary of available printer classes. Printer class A must be defined, it will be used as the default printer class.

Valid class names: A to Z.

Type: single character.

printerclass.<X>

Name of the printer to use for this printer class. Value refers to the key of the printer dictionary.

Type: string.

printer

All available printers.

printer.<name>.name

Name of this printer. Informational purposes only.

Type: string.

printer.<name>.queue

The platform specific spooler queue name for this printer.

On Windows: the windows printer name.

On platforms with CUPS: the CUPS printer name.

Must be specified, or the printer and it’s associated print class will not be available at runtime.

Type: string.

printer.<name>.max_cols

Number of columns per line.

Type: integer.

printer.<name>.max_rows

Number of rows per sheet. Used for tracking of the Blatt-voll condition.

When no more than 6 lines will fit onto the current sheet, Blatt-voll will be set to True. Blatt-voll will be reset when a form feed attribute was encountered, the printer class changes or the current print job ends.

Type: integer.

printer.<name>.functiontable

The printerfunction table to use for this printer. See below.

Type: byte string.

printer.<name>.encoding

Encoding used for sending print job to the printer. Characters not available in the selected encoding will be replaced with question marks (?).

Default: cp850.

Type: string.

Examples: cp850 or utf-8.

printerfunction

Dictionary of printer function tables.

printerfunction.<tablename>.<id>

Specifies the text sequence to send to the printer when the print attribute with id <id> is encountered while printing the model/form definition.

Type: string.

<id> Description
1 Form feed
2 New line, see printerfunction.<tablename>.2.
3 Spaced font on
4 Spaced font off
5 Bold on
6 Bold off
7 Understrike on
8 Understrike off
9 Pitch: 10cpi
10 Pitch: 12cpi
11 6 lines per inch
12 8 lines per inch
13 Set sheet length, see printerfunction.<tablename>.13.
14 Superscript on
15 Superscript off
16 Subscript on
17 Subscript off
18 Printer initialization, see printerfunction.<tablename>.18.
19 Printer reset, see printerfunction.<tablename>.19.
20 Unsupported
21 Italics on
22 Italics off
25 Change printer class. Should not be configured.
26 Unsupported
27 Reverse video on
28 Reverse video off
30 Font color: black
31 Font color: red
32 Font color: green
33 Font color: yellow
34 Font color: blue
35 Font color: purple
36 Font color: cyan
37 Font color: white

Custom attributes can be defined and used.

printerfunction.<tablename>.2

New line / Carriage return, line feed.

This should move the position for the following printed symbols to the start of the next line.

This attribute is special, as it is implicitly used between lines of the model/form definition and there is generally no need to use it explicitly.

printerfunction.<tablename>.13

Set sheet length.

The following byte sequences will be replaced:

Sequence Replacement value Size Format
\xFF\x01 New sheet length 1 byte binary
\xFF\x02 New sheet length 2 bytes ASCII
\xFF\x03 New sheet length + 6 2 bytes ASCII

printerfunction.<tablename>.18

Printer initialization. Will be sent right at the start of the print job.

Should also set the correct paper format and orientation matching max_rows/max_cols.

printerfunction.<tablename>.19

Printer reset. Will be sent just at the end of the print job.