Skip to content

Configuration

Joynare Nexus provides several configuration files to customize its execution, routing, security database, and logging.

The primary configuration files reside in the config/ directory:

  • config/system.yaml — Global system settings (Database, Flow & Route Paths).
  • config/connections.yaml — Database connection pools for SQL adapters.
  • config/logging.yaml — Structured and rotating logging setup.

Global System Settings (system.yaml)

The config/system.yaml file configures the core ESB infrastructure, such as the internal database used for security/metrics and default directories for flow and route discovery.

Example Configuration

yaml
# config/system.yaml

# Internal database configuration for ACL security & metrics
database:
  driver: "mysql"
  dsn: "root@tcp(localhost:3307)/joynare_nexus?parseTime=true"

# Optional path overrides (relative to executable or absolute paths)
flows_dir: "./flows"
routes_dir: "./routes"

Customizing Flow and Route Paths

By default, Joynare Nexus scans the ./flows and ./routes directories respectively. You can customize these directories using three levels of precedence:

1. Precedence Levels

The system resolves the directory path using the following order of precedence:

  1. CLI Flags (Highest): Specifying -f / --flows or -r / --routes directly on the command line always takes priority.
  2. System Config: The flows_dir and routes_dir values defined in config/system.yaml.
  3. Hardcoded Defaults (Lowest): If not specified in either place, the system falls back to ./flows and ./routes.

2. Overriding via system.yaml

To set persistent directories so you don't need to specify flags every time, define them in config/system.yaml:

yaml
flows_dir: "D:/workspace/external-flows"
routes_dir: "D:/workspace/external-routes"

3. Overriding via CLI Flags

To override any configuration on the fly, use the flags directly:

bash
# Execute a flow in a one-off custom directory
go run ./cmd/esb run my:Service --flows "D:/other-flows"

# Start the server with a one-off custom routes directory
go run ./cmd/esb serve --routes "D:/other-routes"

Environment Variable Support

All configuration files (including system.yaml and connections.yaml) support dynamic environment variable resolution using the ${VAR_NAME} syntax:

yaml
database:
  driver: "mysql"
  dsn: "${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST}:${DB_PORT})/${DB_NAME}?parseTime=true"

The system automatically parses and replaces these placeholders with their corresponding system environment variables at runtime.

Released under the ISC License.