Open Source Content Management Framework

Unified configuration

  1. Configuration directives
      1. Type
      2. Host
      3. Name
      4. Username
      5. Password
      6. Encoding
      7. Blobdir
      8. Schema
      9. Logfile
      10. Loglevel
      11. TableCreate
      12. TableUpdate
  2. Additional directives
      1. TestUnit
      2. MidgardUsername
      3. MidgardPassword

Since version 1.8 Midgard provides a unified reusable and "ini like" configuration file. This simple file is editable with any suitable and favorite editor and allows users, developers or administrators to share exactly the same configuration among many Midgard applications or tools.

The convention is always to use configuration's file name as function or program argument. The full path of file (and its real location) is always defined by Midgard library, so code being written once can be shared between systems without any need to redefine the file's location as long as the same filename is kept.

A typical direcory for storing this file is /etc/midgard/conf.d or /usr/local/etc/midgard/conf.d. But the real path may vary according to the prefix chosen for midgard-core during compilation.

If the configuration file midgard is defined and prefix was set to /opt during compilation, the file would be located in /opt/etc/midgard/conf.d.

Additionally, configuration files can be located in user's home directory:

  • $HOME/.midgard/conf.d/

This file (if it exists) is read first. If it doesn't exist, the file from the defined etc directory is read.

Since Midgard 1.9, you may decide what location should be used to look for the configuration file.

Read more about the midgard_config class.

To call midgard-schema from the command line with this configuration file enter:

midgard-schema midgard

To initialize midgard configuration in PHP while running from command line:

<?php mgd_config_init("midgard"); ?>

Configuration directives

All directives are actually "grouped" by global the Database directive. It should be common practice to name the file the same as database. Every directive may be used once in configuration file.

Type

Defines database type. Currently Midgard supports only MySQL as database storage, so this directive is not really used in practice.

This directive doesn't have to be set.

  • default value: MySQL

Host

Host where database server is located. Host may be defined as an IP address or as a domain name.

Example:

Host=192.168.0.77
Host=my.example.com

This directive doesn't have to be set.

  • default value: localhost

If you wish to use remote database with Thor or Ragnaroek, remote server has also to be described in vhost configuration file (e.g. MidgardDatabase 10.240.223.3:midgard midgard midgard)

Name

The name of database which should be used for the database connection.

This directive has to be set.

  • default value: midgard

Username

Username for the user who is able to connect to the database daemon and the database defined defined in Name. If a remote (not localhost) database is defined for the connection, the user is responsible for setting up correct permissions on the remote database server.

This directive has to be set.

  • default value: midgard

Password

Password for the user who is able to connect to database.

This directive has to be set.

  • default value: midgard

Encoding

Database encoding. Similiar to MidgardParser directive from Apache configuration files. Setting utf-8 is highly recommended for internationalization.

This directive doesn't have to be set.

  • default value: utf-8

Blobdir

Full path to directory where blobs are located. Blobs directory is freely user defined.

This directive doesn't have to be set.

  • default value: /var/lib/midgard/blobs/DATABASE_NAME

var/lib in this case depends on prefix which was set for midgard-core during compilation.

Schema

Full path to schema file, including the filename. By default all schemas are read from /usr/share/midgard/schema directory.

/usr/share in this case depends on prefix which was set for midgard-core

This directive doesn't have to be set.

If you change the schema path, remember to update the PEAR MgdSchema path.

  • default value: there is no default value

Midgard library produces warnings during application startup when this directive is uncommented and value is not set

Logfile

Full path to the logfile. In none is defined, output will be printed to stdout. When the configuration file is used with the Apache module and no file is defined, then the output is printed to the Apache error log file.

This directive doesn't have to be set.

  • default value: there is no default value

Loglevel

Log level defined for the application. Available values:

  • error
  • critical
  • warning
  • message
  • info
  • debug

If you want to limit log messages to a specific level, add + ( e.g. message+). A limit like this disables log messages with higher priorities. In this case, when message+ is set, no warning (with higher priority) messages will be logged.

This directive doesn't have to be set.

  • default value: warn

TableCreate

Create tables and columns. This directive is supported by the midgard-schema tool. When is set to true, midgard-schema will call internal library functions which create tables and their columns as the type's storage. Accepted boolean values: true or false.

This directive doesn't have to be set.

  • default value: false

TableUpdate

Update tables and columns. This directive is supported by the midgard-schema tool. When is set to true, midgard-schema will call internal library functions which update tables and their columns as the type's storage. Accepted boolean values: true or false.

This directive doesn't have to be set.

  • default value: false

TableCreate value take precedence over TableUpdate. If TableCreate is set to a negative value, then TaleUpdate is ignored.

Additional directives

TestUnit

Perform tests with registered types. This directive should be used by developers who want to test and debug defined types before using them in a production environment. Basic object methods (like update, create, delete) are invoked when test is in progress. Accepted boolean values: true or false.

This directive doesn't have to be set.

  • default value: false

MidgardUsername

Midgard person's username. Note, that currently only SG0 domain (sitegroup) is supported. Configuration itself doesn't support particular domain (sitegroup).

This directive doesn't have to be set.

  • default value: there is no default value

MidgardPassword

Midgard person's password.

This directive doesn't have to be set.

  • default value: there is no default value
Tagged
midgard
midgard-schema
configuration
Designed by Nemein, hosted by Kafit