Writing configuration files

We support two formats for configuration files that configure Puppet settings: valid JSON and HOCON (Human-Optimized Config Object Notation), a JSON superset.

Read more about HOCON (Human-Optimized Config Object Notation)

Configuration file syntax

Refer to these examples when you’re writing configuration files to identify correct JSON or HOCON syntax.

Brackets

In HOCON you can omit the { and } around a root object.

JSON example HOCON example
{
   "authorization": {
    	"version": 1
    }
}
"authorization": {
    "version": 1
}

Quotes

In HOCON double quotes around key and value strings are optional in most cases. However, double quotes are required if the string contains the characters *, ^, +, :, or =.

JSON HOCON
"authorization": {
    "version": 1
}
authorization: {
    version: 1
}

Commas

When writing a map or array in HOCON, you can use a new line instead of a comma.

JSON HOCON
Map
rbac: {
 password-reset-expiration: 24,
 session-timeout: 60,
 failed-attempts-lockout: 10,
}
rbac: {
 password-reset-expiration: 24
 session-timeout: 60
 failed-attempts-lockout: 10
}
Array
http-client: {
    ssl-protocols: [TLSv1, TLSv1.1, TLSv1.2]
}
http-client: {
    ssl-protocols: [
    TLSv1
    TLSv1.1
    TLSv1.2
    ]
}

Comments

Add comments using either // or #. Inline comments are supported.

HOCON
authorization: {
    version: 1
    rules: [
        {
            # Allow nodes to retrieve their own catalog
            match-request: {
                path: "^/puppet/v3/catalog/([^/]+)$"
                type: regex
                method: [get, post]
            }
        }
    ]
}

↑ Back to top