Beekeeper::Config - Read configuration files
Version 0.09
Beekeeper applications use two config files to define how clients, workers and brokers connect to each other.
These files are looked for in ENV BEEKEEPER_CONFIG_DIR, ~/.config/beekeeper and then /etc/beekeeper.
BEEKEEPER_CONFIG_DIR
~/.config/beekeeper
/etc/beekeeper
This file defines all worker pools running in a given host, specifying which logical bus should be used and which services it will run.
The file format is relaxed JSON, which allows comments and trailing commas.
Each entry define a worker pool. Required parameters are:
pool_id: arbitrary identifier for the worker pool
pool_id
bus_id: identifier of logical bus used by worker processes
bus_id
workers: a map of worker classes to arbitrary config hashes
workers
Example:
[ { "pool_id" : "myapp", "bus_id" : "backend", "description" : "pool of MyApp workers", "workers" : { "MyApp::Service::Foo::Worker" : { "worker_count" : 4 }, "MyApp::Service::Bar::Worker" : { "worker_count" : 2 }, }, }, ]
This file defines all logical buses used by an application, specifying the conection parameters to the MQTT brokers that will service them.
For development purposes it is handy to use a single broker to hold all logical buses and easily simulate a complex topology, but in production enviroments brokers should be isolated from each other.
Each entry define a logical bus. Accepted parameters are:
bus_id: unique identifier of the logical bus (required)
bus_role: specifies if the bus is acting as frontend or backend
bus_role
host: hostname or IP address of the broker
host
port: port of the broker (default is 1883)
port
tls: if set to true enables the use of TLS on broker connection
tls
username: username used to connect to the broker
username
password: password used to connect to the broker
password
[ { "bus_id" : "backend", "host" : "localhost", "username" : "backend", "password" : "def456", }, { "bus_id" : "frontend", "host" : "localhost", "username" : "frontend", "password" : "def456", }, ]
Reads and parse bus.config.json and returns the config of the requested bus.
bus.config.json
Reads and parse pool.config.json and returns the config of the requested pool.
pool.config.json
Reads the given file and returns its content parsed as JSON.
José Micó, jose.mico@gmail.com
jose.mico@gmail.com
Copyright 2015-2023 José Micó.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language itself.
This software is distributed in the hope that it will be useful, but it is provided “as is” and without any express or implied warranties. For details, see the full text of the license in the file LICENSE.
To install Beekeeper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Beekeeper
CPAN shell
perl -MCPAN -e shell install Beekeeper
For more information on module installation, please visit the detailed CPAN module installation guide.