ports.yaml
Overview
The ports.yaml file is a configuration file that defines a set of named port numbers used by various components of the application or system. It serves as a central reference for network ports, enabling consistent and maintainable port assignments across the application infrastructure. This file facilitates easy updates to port numbers without requiring changes to the source code.
Content Description
The file consists of a YAML mapping of keys (port identifiers) to integer values (port numbers). Each key represents a specific service or endpoint within the system, and the corresponding value specifies the port number on which that service is expected to listen.
Defined Ports
Key | Port Number | Description |
|---|---|---|
| 3000 | Port for the Q server service. |
| 8600 | Base port for the BM node component. |
| 8700 | Port for BM API service. |
| 11000 | HTTP URL port for BM node. |
| 12000 | Streaming port for BM node communication. |
| 8600 | REST API port for BM component, same as BM_NODE_PORT. |
Usage
This file is intended to be loaded by configuration parsers within the application or deployment scripts to retrieve port numbers programmatically. By referencing these keys, the application can bind network listeners or configure clients to connect to the appropriate ports.
For example, in a Node.js service:
const config = require('yaml-config-loader').load('ports.yaml');
const port = config.Q_SERVER_MAPPED_PORT;
app.listen(port, () => {
console.log(`Server running on port ${port}`);
});
This approach decouples port assignments from the application logic, improving flexibility and ease of configuration management.
Implementation Details
The file follows the YAML format, which is human-readable and widely supported for configuration files.
Each key is an uppercase string with underscores separating words, following common environment variable naming conventions.
Some ports share the same port number (e.g.,
BM_NODE_PORTandBM_REST_API_PORTboth use 8600), indicating that these services may be combined or share the same network endpoint.The ports cover multiple types of communications, including HTTP URLs and streaming interfaces, suggesting a multi-protocol system architecture.
Interaction with Other System Parts
Components that require network communication will reference this file to obtain their listening ports or target ports.
Deployment scripts and container orchestration tools may use these port definitions to expose and map container ports.
Services such as BM node, BM API, and Q server are likely separate modules or microservices within the system architecture, each binding to their specific ports as defined here.
The file acts as a single source of truth for ports, ensuring consistent configuration across multiple environments (e.g., development, staging, production).
Visual Diagram
flowchart TD
Q_SERVER_MAPPED_PORT["Q_SERVER_MAPPED_PORT: 3000"]
BM_NODE_PORT["BM_NODE_PORT: 8600"]
BM_REST_API_PORT["BM_REST_API_PORT: 8600"]
BM_API_PORT["BM_API_PORT: 8700"]
BM_NODE_HTTP_URL_PORT["BM_NODE_HTTP_URL_PORT: 11000"]
BM_NODE_STREAM_PORT["BM_NODE_STREAM_PORT: 12000"]
BM_NODE_PORT --- BM_REST_API_PORT
The diagram shows the port keys and their assigned port numbers.
The connection between
BM_NODE_PORTandBM_REST_API_PORTindicates that these two share the same port number and likely represent the same service endpoint or a closely related service.
For further details on topics related to network port configuration and service communication, see Network Configuration and Service Architecture.