Skip to content

Feature/new config system 2 recursive#1736

Closed
yanick wants to merge 27 commits into
mainfrom
feature/new-config-system-2-recursive
Closed

Feature/new config system 2 recursive#1736
yanick wants to merge 27 commits into
mainfrom
feature/new-config-system-2-recursive

Conversation

@yanick

@yanick yanick commented Jun 24, 2025

Copy link
Copy Markdown
Contributor

Allow #1637 to bootstrap itself (i.e. have the base File::Simple config reader to instantiate and use subsequent config readers).

Will become undrafted when the parent PR is merged.

mikkoi and others added 25 commits June 16, 2025 22:49
Role::Config is the configuration part of an object
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Remove everything that has to do with loading config
from files or elsewhere.

Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Create Dancer2::Core::Role::ConfigReader and Dancer2::ConfigReader::File::Simple.

Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Also specify lazy => 1.

Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
* Remove previously commented out code
* Remove 'use Data::Dumper'

Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Signed-off-by: Mikko Johannes Koivunalho <mikko.koivunalho@iki.fi>
Comment thread lib/Dancer2/ConfigReader/File/Simple.pm Outdated
@@ -0,0 +1,220 @@
# ABSTRACT: Config reader for files

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ooops, the rename wasn't caught. This shouldn't be here.

@yanick yanick force-pushed the feature/new-config-system-2-recursive branch from b565f92 to 1cf0d60 Compare July 12, 2025 22:54
@yanick yanick marked this pull request as ready for review July 12, 2025 22:56
@cromedome

Copy link
Copy Markdown
Contributor

\o/ 👍 This is a nice enhancement to the new config changes.

@bigpresh bigpresh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few minor tweaks suggested, but none of which feel like full blockers to me.

I do wonder if B<ConfigReader> should be C<ConfigReader> throughout, though - I'd have used the latter personally.

Comment thread lib/Dancer2/Config.pod
Comment on lines +607 to +608
Outputs a lot of debugging information when generating the configuration of
the application.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we mean "generating" here, or "reading"?

Comment on lines +91 to +92
die "additional_config_readers entry can have only one key\n"
if 1 < keys %$thing;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it'd be a bit more readable as if keys %$thing != 1, and it would also catch any case where we were passed an empty hashref too.

Suggested change
die "additional_config_readers entry can have only one key\n"
if 1 < keys %$thing;
die "additional_config_readers entry must have exactly one key\n"
if keys %$thing != 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree. Yanick is AFK for the next few weeks, so I will update and merge today.

Comment on lines +165 to +167
This class provides a C<config> attribute that
is populated by executing one or more B<ConfigReader> packages.
The default ConfigReader used by default is C<Dancer2::ConfigReader::Config::Any>.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Slightly less tautology:

Suggested change
This class provides a C<config> attribute that
is populated by executing one or more B<ConfigReader> packages.
The default ConfigReader used by default is C<Dancer2::ConfigReader::Config::Any>.
This class provides a C<config> attribute which is populated by executing
one or more B<ConfigReader> packages.
The default ConfigReader used is L<Dancer2::ConfigReader::Config::Any>.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Much better! I will make this change and merge today.

@cromedome

Copy link
Copy Markdown
Contributor

Merged, including changes from @bigpresh. Thanks all!

@cromedome cromedome closed this Jul 18, 2025
cromedome added a commit that referenced this pull request Sep 15, 2025
    [ BUG FIXES ]
    * GH #1701: Split cookie values on & only (Yanick Champoux)

    [ ENHANCEMENTS ]
    * GH #530: Make data censoring configurable (Yanick Champoux, David
      Precious)
    * GH #850: Scaffold tutorial app; allow multiple apps to be scaffolded
      in core Dancer2 (Jason A. Crome)
    * GH #1512: Log hook entries as they are executed (Yanick Champoux)
    * GH #1615: Remove Dancer2::Template::Simple from Dancer2 core (Jason
      A. Crome)
    * PR #1637: New, extendable configuration system (Mikko Koivunalho)
    * GH #1723: Enable use of a different Template Toolkit base class
      (Andy Beverley)
    * PR #1727: Don't create CPAN package files when generating new apps
      (Jason A. Crome)
    * PR #1731: Retire Template::Tiny fork, use CPAN's (Jason A. Crome,
      Karen Etheridge, Damien Krotkine, Yanick Champoux)
    * PR #1736: Allow config system to bootstrap itself (Yanick Champoux)
    * GH #1737: Add on_hook_exception for errors during hook processing
      (Andy Beverley)
    * PR #1739: Add source to on_hook_exception (Andy Beverley)
    * PR #1742: Refactor CLI for future expansion (Jason A. Crome)

    [ DOCUMENTATION ]
    * GH #1342: Document skipping private methods in pod coverage tests
      (Jason A. Crome)
    * PR #1721: New Dancer2 docs, reorganization of all documentation;
      from TPRF grant (Jason A. Crome)
    * PR #1741: Cover items missed in earlier documentation branch (Jason
      A. Crome)

    [ DEPRECATED ]
    * None

    [ MISC ]
    * None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants