Environment Variables

You can use environment variables to configure Liferay DXP, which is especially useful in cloud-based environments.

Overriding Portal Properties

To override portal properties, follow these operating system (OS) and Liferay environment variable name guidelines:

OS environment variable names:

  • Consist of uppercase letters, digits, and _ (underscore) characters only
  • Must not start with a digit

Liferay environment variable names:

  • Must follow the OS environment variable name guidelines
  • Must start with the prefix LIFERAY_
  • Characters that violate the OS guidelines must be encoded using one of the following methods:

Encoding with CharPool Constants

Follow these rules to encode with CharPool constants:

  • Use upper case (CharPool constant names are uppercase).
  • Remove _ characters from the CharPool constant names.
  • Wrap each constant name in a pair of _ characters.

Here are some encoding examples.

CharPool Constant Example 1

This example involves encoding the period . character.

Portal property:

setup.wizard.enabled=false

Encoding steps:

  1. Prefix the variable with LIFERAY_.

    LIFERAY_setup.wizard.enabled=false

  2. Encode the period characters with the CharPool constant name PERIOD, surrounded by a pair of _ characters.

    LIFERAY_setup_PERIOD_wizard_PERIOD_enabled=false

  3. Convert all letters to uppercase.

Environment variable:

LIFERAY_SETUP_PERIOD_WIZARD_PERIOD_ENABLED=false

CharPool Constant Example 2

This example uses CharPool constants to encode an environment variable name for a property that includes periods, brackets, and uppercase characters.

Portal property:

setup.database.driverClassName[mysql]=com.mysql.jdbc.Driver

Encoding steps:

  1. Prefix the variable with LIFERAY_.

    LIFERAY_setup.database.driverClassName[mysql]=com.mysql.jdbc.Driver

  2. Use CharPool constant names surrounded by _ characters:

    • ._PERIOD_
    • C_UPPER_CASE_C_
    • N_UPPER_CASE_N_
    • [_OPEN_BRACKET_
    • ]_CLOSE_BRACKET_

    LIFERAY_setup_PERIOD_database_PERIOD_driver_UPPER_CASE_C_lass_UPPER_CASE_N_ame_OPEN_BRACKET_mysql_CLOSE_BRACKET_=com.mysql.jdbc.Driver

  3. Remove underscores from all constant names.

    • _UPPER_CASE_C__UPPERCASEC_
    • _UPPER_CASE_N__UPPERCASEN_
    • _OPEN_BRACKET__OPENBRACKET_
    • _CLOSE_BRACKET__CLOSEBRACKET_

    LIFERAY_setup_PERIOD_database_PERIOD_driver_UPPERCASEC_lass_UPPERCASEN_ame_OPENBRACKET_mysql_CLOSEBRACKET_=com.mysql.jdbc.Driver

  4. Convert all letters to uppercase.

Environment variable:

LIFERAY_SETUP_PERIOD_DATABASE_PERIOD_DRIVER_UPPERCASEC_LASS_UPPERCASEN_AME_OPENBRACKET_MYSQL_CLOSEBRACKET_=com.mysql.jdbc.Driver

Encoding with Unicode Code Points

Unicode offers more character encodings than CharPool and produces shorter variable names. But Unicode code points are cryptic.

Follow these rules to encode with Unicode:

  1. Look up the character code points.

  2. Replace each character with a code point wrapped in a pair of _ characters.

Here’s an encoding example that uses Unicode.

Unicode Example

This example uses code points to encode an environment variable name for a portal property that contains periods, brackets, and uppercase characters.

Portal property:

setup.database.driverClassName[mysql]=com.mysql.jdbc.Driver

Encoding steps:

  1. Prefix the variable with LIFERAY_.

    LIFERAY_setup.database.driverClassName[mysql]=com.mysql.jdbc.Driver

  2. Use CharPool constant names surrounded by _ characters to encode the following characters:

    • ._46_
    • C_67_
    • N_78_
    • [_91_
    • ]_93_

    LIFERAY_setup_46_database_46_driver_67_lass_78_ame_91_mysql_93_=com.mysql.jdbc.Driver

  3. Convert all letters to uppercase.

Environment variable:

LIFERAY_SETUP_46_DATABASE_46_DRIVER_67_LASS_78_AME_91_MYSQL_93_=com.mysql.jdbc.Driver

Congratulations! You know how to use environment variables to configure Liferay DXP. It’s easier than ever to configure and deploy Liferay DXP images in virtual machines and cloud containers.

Configuring Liferay DXP

System Wide Settings

« Understanding System Configuration FilesServer Administration »
この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています