Skip to content

[FrameworkBundle] Add ability to override name of the config directory #42218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

ivanstan
Copy link

@ivanstan ivanstan commented Jul 21, 2021

Q A
Branch? 5.4
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #...
License MIT
Doc PR symfony/symfony-docs#...

For way too long Symfony is following Linux directory structure for all of its directories except for config, if we don't plan to change /config to /etc at least we can avoid hard-coding it and allow overriding of the method getConfigDir in Kernel.php

@carsonbot
Copy link

Hey!

To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done?

Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review.

Cheers!

Carsonbot

@ivanstan ivanstan marked this pull request as ready for review July 21, 2021 12:20
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 5.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@sstok
Copy link
Contributor

sstok commented Jul 21, 2021

Please use a descriptive title.

FYI. This will require an update to Flex-plugin as well as recipes expect this convention.

@ivanstan ivanstan changed the title Update MicroKernelTrait.php Add ability to override name of the config directory Jul 21, 2021
@stof
Copy link
Member

stof commented Jul 21, 2021

FYI. This will require an update to Flex-plugin as well as recipes expect this convention.

If we don't change the default, I don't think it will impact Flex (other parts of Flex already assume you use the standard symfony structure rather than a customized one)

@ivanstan
Copy link
Author

FYI. This will require an update to Flex-plugin as well as recipes expect this convention.

If we don't change the default, I don't think it will impact Flex (other parts of Flex already assume you use the standard symfony structure rather than a customized one)

I think preferred approach would be to first implement a function that returns a config directory path without changing the default, with a possibility for a user to override it on his own responsibility. This will give some time to the flex and recipe developers to start relying on this function before decision is made if actually the directory name is gonna change.

@Tobion
Copy link
Contributor

Tobion commented Jul 21, 2021

@sstok probably means it somewhat requires an update of the recipes, e.g. https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/5.4/src/Kernel.php to make use of the config dir method.

I'm also 👎 as there are is not enough demand for such a change. People who really want to diverge from documentation and flex support etc, can just overwrite the relevant kernel methods themselves.

@Nyholm
Copy link
Member

Nyholm commented Jul 22, 2021

Hm.. I agree with @Tobion that it is not a great demad for this.

However, this patch is super small and Im not sure we have any other hard coded path like this.

This will (or SHOULD) obviously only be used by super advanced that have really good reasons by doing so. Just "I want to follow Unix standards" is not really a strong argument.

So, Yes, (almost) nobody should use this. But Im fine with this small patch anyways.

@ivanstan, may I ask you if you have a good reason for using /etc instead? What part of your work/application would be simpler if you could use /etc

@ivanstan
Copy link
Author

ivanstan commented Jul 22, 2021

@Nyholm To be honest its just my OCD. Other than the fact that all other directories are configurable.

@Nyholm
Copy link
Member

Nyholm commented Jul 22, 2021

Hehe. I’ve been there. But I guess that is something you need to fight though or override registerContainerConfiguration() and registerBundles() yourself.

I’m leaning towards closing this. I’ll wait an opinion from some other maintainer.

@nicolas-grekas nicolas-grekas added this to the 5.4 milestone Jul 22, 2021
@ivanstan
Copy link
Author

@Nyholm Yes, I have those methods overridden in most of my projects :)

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

I would be +0 if the method were private.

@ro0NL
Copy link
Contributor

ro0NL commented Jul 22, 2021

Copy link
Member

@yceruto yceruto left a comment

Choose a reason for hiding this comment

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

I'm also not sure if it will be worth it, from what I've read in other comments, and because config/ dir matches package standards (https://github.com/php-pds/skeleton).

If we do it for apps, why don't we do the same for bundles?

I'm -1 so far.

@@ -124,7 +129,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
$kernelDefinition->addTag('routing.route_loader');

$container->addObjectResource($this);
$container->fileExists($this->getProjectDir().'/config/bundles.php');
Copy link
Member

Choose a reason for hiding this comment

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

There are other occurrences in FrameworkBundle/DependencyInjection/FrameworkExtension.php ( <project_dir>/config/validator and <project_dir>/config/serializer ).

Also, we are hardcoding it here:

->scalarNode('vault_directory')->defaultValue('%kernel.project_dir%/config/secrets/%kernel.runtime_environment%')->cannotBeEmpty()->end()

@carsonbot carsonbot changed the title Add ability to override name of the config directory [FrameworkBundle] Add ability to override name of the config directory Aug 1, 2021
@fabpot
Copy link
Member

fabpot commented Oct 29, 2021

Done as part of #42991. Thank you.

@fabpot fabpot closed this Oct 29, 2021
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.