Skip to content

Conversation

@alithethird
Copy link
Contributor

This PR is related to 12 Factor Block on missing required config PR

Rationale

Some applications require certain config options to run and would crash if these options are not provided. To prevent this, we need to add an optional field to the config options and block the charm if a config option marked as non-optional has not been provided with a message that explains which config options are missing.

To stay backward compatible the default value for the optional field will be true.

Since it doesn’t make sense for config options that are non-optional to have a default value, charmcraft will look for this condition at pack time and error out.

Extension Changes

Adds a check for non-optional options with default values and throws ExtensionError when found.
Adds documentation about the non-optional options.

Reviewers:
@jdkandersson
@javierdelapuente
@erinecon

Copy link
Contributor

@erinecon erinecon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this section to the reference pages! I have some feedback on the wording that I only added to the Django page but applies to all of the pages.

The biggest change I'm suggesting: I removed the non-optional syntax because it's not used from a coding perspective, meaning that a user wouldn't add non-optional anywhere in the YAML file. Please correct me if I'm mistaken.

@lengau lengau changed the title Feat(extension): Block on missing required config feat(extension): Block on missing required config Feb 21, 2025
Copy link
Contributor

@erinecon erinecon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! The note at the end is rendering strangely in the RTD build, otherwise I left two nitpicks on the Django doc that apply to all the pages :)

Copy link
Collaborator

@lengau lengau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved on the code side. Deferring to @medubelko and @erinecon on docs

Copy link
Contributor

@medubelko medubelko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestions apply to all affected docs. Thanks!

@lengau lengau added this pull request to the merge queue Feb 26, 2025
Merged via the queue into canonical:main with commit c65d0dc Feb 26, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants