robotcode icon indicating copy to clipboard operation
robotcode copied to clipboard

[ENHANCEMENT] Support for multiple TOML Files in `robot.toml`

Open d-biehl opened this issue 1 year ago • 1 comments

Description:

Overview: I would like to propose an enhancement for RobotCode to support the inclusion of external TOML files within the robot.toml configuration file. This feature would allow for a modular and organized configuration management approach, enabling users to maintain cleaner and more manageable TOML files.

Current Behavior: Currently, the robot.toml file does not support including other TOML files directly. Multiple configuration files can be specified via the command line, but this approach can become cumbersome and less intuitive for managing complex configurations.

Proposed Enhancement: I propose adding support for including external TOML files within the robot.toml file using a config_files directive. This directive would allow users to specify additional TOML files to be included and merged into the main configuration.

Example Usage: Here is an example of how the config_files directive could be used in robot.toml:


# Import additional configuration files
config-files = [
    "config/movement.toml",
    "config/sensors.toml",
    "config/actuators.toml"
]

extend-config-files = [
    "config/movement.toml",
    "config/sensors.toml",
    "config/actuators.toml"
]

The contents of the imported TOML files would be merged with the main robot.toml configuration. If there are conflicts, the values in the main robot.toml file would take precedence.

Benefits:

  1. Modularity: Allows for a more modular configuration setup, making it easier to manage large and complex configurations.
  2. Organization: Helps in organizing configurations by separating different aspects into individual files.
  3. Reusability: Promotes reusability of configuration files across different projects or components.
  4. Ease of Use: Simplifies the process of managing configurations without relying on command-line arguments.

Implementation Considerations:

  1. Parsing Order: The imported files should be parsed and merged in the order they are listed.
  2. Conflict Resolution: Clearly define how conflicts are resolved when merging configurations.
  3. Error Handling: Provide meaningful error messages if imported files are missing or contain invalid syntax.

Conclusion: Adding support for importing external TOML files in the robot.toml configuration file would greatly enhance the flexibility and manageability of configurations in RobotCode. This feature would complement the existing command-line options and provide a more intuitive way to handle complex configurations. I believe this feature would be a valuable addition and look forward to discussing its potential implementation.

d-biehl avatar Jul 29 '24 10:07 d-biehl

Overview: I would like to propose an enhancement for RobotCode to implement a modular configuration system using a robot.toml.d directory. This approach is inspired by the way many Linux configuration files are handled in the /etc directory. Instead of introducing a config-files directive within robot.toml, users would have the option to split their configurations into multiple files placed within a designated robot.toml.d directory. This would provide a more structured and maintainable method of managing complex configurations.

Current Behavior: At present, the robot.toml file does not support including multiple TOML configuration files unless specified manually via the command line. This can become unwieldy when dealing with large configurations or when modularity is required.

Proposed Enhancement: I propose adding support for a robot.toml.d directory that RobotCode would automatically scan and merge any TOML files found within this directory with the main robot.toml file. The directory structure could look something like this:

project/
│
├── robot.toml
└── robot.toml.d/
     ├── 01_dev.toml
     ├── 02_prod.toml
     └── 03_browsers.toml

The merging of configurations would follow a specific order:

  1. robot.toml (if present) is read first.
  2. robot.toml.d directory files are read next, in alphanumerical order.

Benefits:

  • Modularity: This approach allows for a modular configuration setup, breaking down complex configurations into smaller, more manageable parts.
  • Organization: It enhances the organization of configurations, providing a clean and structured way to manage them.
  • Reusability: Configuration files in robot.toml.d can be reused across different projects or components.
  • Simplicity: Automatically reading from the robot.toml.d directory removes the need to specify multiple files via command-line arguments.

d-biehl avatar Sep 04 '24 13:09 d-biehl