Configuration

A user’s LZadmin configuration for code generation is normally defined in a YAML file named “config.yml”. In addition, a “super.config.yml” can be used to override any parameters in “config.yml”. This could be used for enforcing authentication policy, passwords or deployment settings in a hosted environment for example.

The specification of the allowable structure and values for each top level configuration key word is described in the following sections. Note that any alternative YAML syntax which results in the same data structures may also be used in the config file.

db_connect:

The value is a map providing parameter values required for the backend to connect with the database accessed by LZadmin. The parameters accepted will depend to some extent upon the Database being used. The following key words are accepted by all database adapters:

  • adapter: string, the name of the database adapter, e.g. “mysql”
  • database: string, name of the database in the RDBMS
  • username: string, database account user name to use when connecting
  • password: string, database account user password in plaintext

Example:

db_connect:
  adapter: mysql
  database: warehouse_production
  username: admin
  password: EzDoesIt!

The strings representing the database adapters are one of: (db2, mysql, oracle, sqlite, sybase, firebird, frontbase, openbase, postgresql, sqlserver)

Other common key word parameters used for remote connections include:

  • host: string, the host name or IP address of the system containing the database
  • port: string, the port number where to connect

Please see the Rails documentation for the complete list of connection parameters for the specific adapter you are using.

ws_http_host:

The value is a string containing the host name where the backend WSDL service is located. This is used by the Laszlo Presentation Server to connect to the backend. Example:

ws_http_host:
  localhost

ws_http_port:

The value is a string containing the port where the backend WSDL service is found. This is used by the Laszlo Presentation Server to connect to the backend. Example:

ws_http_port:
  3000

auth_client:

The value is true or false. True indicates that authentication should be done at the client prior to starting the application. This key is optional and a missing key is the same as a false value. See auth_user for more information.

auth_user:

The value is map of User Name entries. Each entry is also a map with the key words ‘password’ and ‘permission’ followed by their values. Password values are in plaintext which are then stored as a MD5 hash values in the client application code. Permission values may be ‘read’ which means read access only or ‘write’ which means read/write access is allowed. This key is mandatory if auth_client is true. Example:

auth_user:
  jdoe:
    password: XyZ1357!0
    permission: write
  esmith:
    password: redrose
    permission: read
  cmartin:
    password: precious123
    permission: write

class_list:

The value is a list of strings each of which is a Class Name to include when generating the application (Please see the Background Technical Information section on class and table names). This key is mandatory. Example:

class_list:
  - User
  - Group
  - Company
  - CorporateSite
  - Resource

class_tree:

The value is a nested map of Class Names. This is used to create a tree of classes (which might represent a heirarchy of “belongs to” relationships) and is used to generate a class navigation feature in the client UI. This key is optional and if missing, a “flat tree” will be generated based on the ‘class_list’. Example:

class_tree:
  Company:
  Site:
    Resource
  Group:
    User

form_label_style:

The value is one of the following strings that are styles of representing the class attributes (or table column names in database terms) in GUI forms.

  • column_name: Use the table’s column name
  • spaces: Column name with underscores replaced with spaces (’ ‘)
  • cap_spaces: Same as ‘spaces’ but with first word capitalized
  • cap_all_spaces: Same as ‘spaces’ but with all words capitalized
  • upper: All alphabetical characters in upper case
  • upper_spaces: Alphabeticals in upper case and spaces replace underscores
  • humanize: Same as ‘cap_spaces’ but removes any trailing ‘_id’ suffix

If this tag is not defined, then the default value used is ‘column_name’.

enum_types:

The value is a 2 level nested map each entry of which represents one Enumerated Type. Each Enumerated Type’s value is a map where each entry represents an Item. Each Item maps a string name to a number used to order the Items. This is used to define the order in drop down lists or radio button groups. This construct is defined and supported by LZadmin and is not implemented with the database’s native enumerated type, but rather with a string type. This allows consistency of usage across databases and improved transparency of the value when viewing the database directly. This key is optional. Example:

enum_types:
  ProductType:
    STOCK: 0
    OPTION: 1
    FUTURE: 2
    WARRANT: 3
  Exchange:
    NYSE: 0
    AMEX: 1
    NASD: 2
    PINK: 3

class_enums:

The value is a 2 level nested map where each entry is also a mapping between a Class Name and an instance of one use of an Enumerated Type within that class. Each instance relates a column (or attribute in a class) to an Enumerated Type Name. This is used to enforce data validation at the backend when writing enumerations to the column. The value must be the string name of one of the enumeration Items defined under ‘enum_types’. This key is optional, but should normally be used when enum_types are defined and data validation is desired.

Also, this key is unnecessary if ‘create_tables’ is used with Enumerated Type names wherever they are used in the database, since it provides the same information there. If the database schema is already defined, then this key provides a way to associate enumerations with their usage in the database. Another valid approach is to only use Basic Types in ‘create_tables’ and specify all usage of Enumerated Types under this key.

Example:

class_enums:
  Product:
    product_type: ProductType
  Company:
    listed_exchange: Exchange

previous | up | next