Determine recipe pattern for optional config and modules

Created on 19 August 2022, over 2 years ago
Updated 24 January 2023, over 2 years ago

Problem/Motivation

Currently install profiles like standard provide optional configuration. When modelling these as recipes, we face the question of how to support such conditionality. For example, various media-related configuration entities will be installed only if/when the media module is installed. To replicate this functionality in a standard recipe, we'll need the ability to install with our without including media and the recipes that require it.

Proposed resolution

One possible approach would be an install mode where all recipes listed under "suggest" are installed. In this approach, a standard recipe would suggest optional recipes. At recipe run time, an optional argument determines whether the suggested packages are also installed. This may require user feedback; see Make it possible for recipes to prompt for input values Fixed .

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

10.0

Component

Code

Created by

🇨🇦Canada nedjo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India narendraR Jaipur, India

    I am also facing similar problem where I need to convert a contributed module ( https://www.drupal.org/project/acquia_cms_event ) functionality as recipe. This module creates an Event content type and related configuration are stored in config/optional folder.
    What should be the approach to convert it to a Recipe?

  • 🇺🇸United States thejimbirch Cape Cod, Massachusetts

    We are slowly identifying this as a top issue.

  • 🇺🇸United States thejimbirch Cape Cod, Massachusetts
  • 🇩🇪Germany jurgenhaas Gottmadingen

    I may be wrong with this, but in the context of an installation profile, the config/optional doesn't really make much sense. The installation profile is deterministic as it fully controls what's installed and what not. In other words, the installation profile knows exactly what's available and therefore doesn't actually need the optional configuration. That's different for modules, as they can't tell the context in which they get installed. So, if modules come with optional configuration, that makes sense to me.

    A recipe, on the other hand, is declarative and describes exactly what it requires and applies that in total to the Drupal site.

    Thinking outside the box, do we really require optional configuration with properly structure recipes that depend upon each other?

  • 🇨🇦Canada b_sharpe

    I would agree with #7. A recipe doesn't have optional config, it's either there or it's not. Module config is not going away nor should required/optional config be converted to a recipe for it (IMO) as the module is saying "Do this always, and if this other thing exist during install, also apply that". A recipe on the other hand could install this same module as well as whatever it requires to get it's optional config to go along with (among other things).

  • 🇺🇸United States thejimbirch Cape Cod, Massachusetts

    I agree with #7 and #8. Recipes are declarative and should not leave anything to be optional.

    The recipe author, to #4's question should decide whether they want the functionality or not, and create their recipes as needed.

    I would like to close this issue as Work's as designed, but I feel like we should document how to deal with optional config in modules and installation profiles in the recipe author guide in the docs.

  • Status changed to Closed: works as designed 6 months ago
  • 🇺🇸United States thejimbirch Cape Cod, Massachusetts
  • 🇸🇪Sweden johnwebdev

    Have this been documented?

  • 🇺🇸United States thejimbirch Cape Cod, Massachusetts
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024