Skip to content
\n
\n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n\n \n \n \n \n
private function _createConfigObj(string $category): object
{
$config = $this->getConfigFromFile($category);
switch ($category) {
case self::CATEGORY_CUSTOM:
return (object)$config;
case self::CATEGORY_DB:
$configClass = DbConfig::class;
$envPrefix = 'CRAFT_DB_';
break;
case self::CATEGORY_GENERAL:
$configClass = GeneralConfig::class;
$envPrefix = 'CRAFT_';
break;
default:
throw new InvalidArgumentException(\"Invalid config category: $category\");
}
\n
\n
\n

\n

Am I missing something here? Do all file-based config overrides need to use a custom config file now or can we have module specific overrides name after the module id?

\n

I believe this method does what I need if I can target a custom config that is not named custom:

\n
getConfig()->getConfigSettings('my-custom-module');\"">
Craft::$app->getConfig()->getConfigSettings('my-custom-module');\n
\n

And if the default case return the config that got created (which it currently does not):

\n
  default:\n    return $config;\n    break;
\n

Or am I misunderstanding how the new BaseConfig custom config stuff works now?

","upvoteCount":1,"answerCount":6,"acceptedAnswer":{"@type":"Answer","text":"

We aren’t ready for plugins to start supporting fluent configs yet. It will be possible in Craft 5, though.

","upvoteCount":2,"url":"https://github.com/craftcms/cms/discussions/12686#discussioncomment-5013165"}}}
/ cms Public

Migrating settings to BaseConfig and using custom configs #12686

Answered by brandonkelly
BenParizek asked this question in Q&A
Discussion options

You must be logged in to vote

We aren’t ready for plugins to start supporting fluent configs yet. It will be possible in Craft 5, though.

Replies: 6 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@brandonkelly
Comment options

Comment options

You must be logged in to vote
1 reply
@BenParizek
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by brandonkelly
Comment options

You must be logged in to vote
1 reply
@brandonkelly
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants