aah framework Configuration
The configuration syntax used by aah framework is
forge developed by @brettlangdon which is very similar to HOCON syntax. aah uses enhanced version of forge by the author of aah @jeevatkm. Syntax applies to
i18n message files and
Table of Contents
- Supported value types
- Key-value separator
- Environment Variables
- The line starts with
#considered as comment.
- You can have same line comment after
;. For e.g:
identifier = "value"; # comment here
- Root doesn’t start with curly braces.
- Section must have curly braces - values are enclosed with opening and closing brace.
Supported value types
String- must be quoted string
Integer- positive and negative value supported
Float- positive and negative value supported
Boolean- true or false of any case (e.g. TRUE, True, true, FALSE, False, false)
List/Array- string, integer, float supported. Values are separated by commas and surrounded by brackets. It can be multi line too
OS Environment variables- $ENV_VAR - More info below
Key-value and separator
=character used to separate keys from values.
- The key can have
An include statement tells the config parser to include the contents of another config file where the include statement is defined. Includes are in the format
include "<pattern>". The
<pattern> can be any glob like pattern which is compatible with path.filepath.Match. It can be absolute path or relative path to
# Environment profile configurations # Load all the configuration files from `appbasedir/config/env/*.conf`. include "./env/*.conf"
An environment is a way to pull in environment variables into your config. Environment variables are identifiers which start with a dollar sign (For example:
$PATH). Environment variables are always represented as strings and are evaluated at parse time. Adapted to supported value type.
instance_name = $AAH_INSTANCE_NAME
Substitutions/Reference are a way of referring to other parts of the configuration into another identifier.
- Global Reference - An identifier which may contain periods, the references are resolved from the global section. For example:
- Local Reference - An identifier which main contain periods which starts with a period, the references are resolved from the settings current section. For example: