검색

이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 13. File-based configuration

download PDF

AMQ C++ can read the configuration options used to establish connections from a local file named connect.json. This enables you to configure connections in your application at the time of deployment.

The library attempts to read the file when the application calls the container connect method without supplying any connection options.

13.1. File locations

If set, AMQ C++ uses the value of the MESSAGING_CONNECT_FILE environment variable to locate the configuration file.

If MESSAGING_CONNECT_FILE is not set, AMQ C++ searches for a file named connect.json at the following locations and in the order shown. It stops at the first match it encounters.

On Linux:

  1. $PWD/connect.json, where $PWD is the current working directory of the client process
  2. $HOME/.config/messaging/connect.json, where $HOME is the current user home directory
  3. /etc/messaging/connect.json

On Windows:

  1. %cd%/connect.json, where %cd% is the current working directory of the client process

If no connect.json file is found, the library uses default values for all options.

13.2. The file format

The connect.json file contains JSON data, with additional support for JavaScript comments.

All of the configuration attributes are optional or have default values, so a simple example need only provide a few details:

Example: A simple connect.json file

{
    "host": "example.com",
    "user": "alice",
    "password": "secret"
}

SASL and SSL/TLS options are nested under "sasl" and "tls" namespaces:

Example: A connect.json file with SASL and SSL/TLS options

{
    "host": "example.com",
    "user": "ortega",
    "password": "secret",
    "sasl": {
        "mechanisms": ["SCRAM-SHA-1", "SCRAM-SHA-256"]
    },
    "tls": {
        "cert": "/home/ortega/cert.pem",
        "key": "/home/ortega/key.pem"
    }
}

13.3. Configuration options

The option keys containing a dot (.) represent attributes nested inside a namespace.

Table 13.1. Configuration options in connect.json
KeyValue typeDefault valueDescription

scheme

string

"amqps"

"amqp" for cleartext or "amqps" for SSL/TLS

host

string

"localhost"

The hostname or IP address of the remote host

port

string or number

"amqps"

A port number or port literal

user

string

None

The user name for authentication

password

string

None

The password for authentication

sasl.mechanisms

list or string

None (system defaults)

A JSON list of enabled SASL mechanisms. A bare string represents one mechanism. If none are specified, the client uses the default mechanisms provided by the system.

sasl.allow_insecure

boolean

false

Enable mechanisms that send cleartext passwords

tls.cert

string

None

The filename or database ID of the client certificate

tls.key

string

None

The filename or database ID of the private key for the client certificate

tls.ca

string

None

The filename, directory, or database ID of the CA certificate

tls.verify

boolean

true

Require a valid server certificate with a matching hostname

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.