Skip to content

[💡 FEATURE REQUEST]: Support optional configuration files in include #2369

Description

@MihailDev

Plugin

Config

I have an idea!

Problem

RoadRunner supports merging multiple configuration files using the include section:

include:
  - .rr.local.yaml

However, all included files are currently required. If .rr.local.yaml does not exist, RoadRunner fails to start:

handle_serve_command:
config_plugin_init: open .rr.local.yaml: no such file or directory

This makes it difficult to use local configuration overrides.

A common project structure is:

.rr.yaml # Base configuration committed to Git
.rr.local.yaml # Optional developer-specific configuration ignored by Git

The base configuration should work without requiring every developer, CI environment, or production deployment to create an empty .rr.local.yaml file.

Proposed solution

Support an extended include syntax with an optional flag:

include:
  - file: .rr.local.yaml
    optional: true

When optional is true:

If the file exists, RoadRunner loads and merges it normally.
If the file does not exist, RoadRunner skips it without failing.
Other errors, such as invalid YAML or insufficient permissions, should still produce an error.

Required includes could use:

include:
  - file: .rr.common.yaml
    optional: false

The existing scalar syntax should remain supported for backward compatibility:

include:
  - .rr.common.yaml

It could be treated as equivalent to:

include:
  - file: .rr.common.yaml
    optional: false

Example
version: "3"

include:
  - file: .rr.common.yaml
  - file: .rr.local.yaml
    optional: true

This would provide native support for developer-specific configuration overrides without requiring wrapper scripts, Makefiles, Docker entrypoints, or placeholder files.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-feature-acceptedCategory: Feature discussed and accepted

Projects

  • Status
    🔖 Ready

Relationships

None yet

Development

No branches or pull requests

Issue actions