All Projects → emqx → hocon

emqx / hocon

Licence: Apache-2.0 License
HOCON configuration Parser for Erlang/OTP

Programming Languages

erlang
1774 projects

Hocon

LALR grammar based HOCON-like configuration Parser for Erlang/OTP.

Spec

HOCON spec for reference: https://lightbend.github.io/config/

Divergence from Spec and Caveats

  • No unicode support (at least not verified).
  • The forbidden character @ is allowed in unquoted strings.
  • Value concatenation is not allowed in keys e.g. a b c : 42 is invalid.
  • Newlines do not prevent concatenation.
    • String (All below are parsed to the same result, which is #{key => <<"value1value2">>})
      • "key=value1 value2"
      • "key=value1value2"
      • "key=\"value1\" \"value2\""
      • "key=value1\nvalue2"
    • Array (#{key => [1,2,3,4]})
      • key=[1, 2] [3, 4]
      • key=[1, 2]\n[3, 4]
      • key=[1,2,3,4]
    • Object (#{key => #{a => 1,b => 2}}):
      • key={a: 1} {b: 2}
      • key={a: 1}\n{b: 2}
      • key={a=1, b=2}
  • url()/file()/classpath() includes are not supported

Schema

HOCON schema (hocon_schema) is a type-safe data validation framework. which is compatible to basho cuttlefish

See more information in SCHEMA.md

Test Data

Files in sample-configs are collected from https://github.com/lightbend/config/tree/v1.4.1

TODO

  • Upload to hex.pm

Reference

License

Apache License 2.0, see LICENSE.

Authors

EMQ X team

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].