-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Make config location editable via option #43
base: 3.5
Are you sure you want to change the base?
Conversation
This makes it posible to define an alternative location for your config file. For example you want it inside a config folder or outside your project root. Simply define the env variable CRUNZ_CONFIG in your environment or export before executing the command: ie: export CRUNZ_CONFIG=config/crunz.yml && php vendor/bin/crunz
Hello, I like the idea but would like to see it as |
@PabloKowalczyk I've updated my PR. Config setting is now available via --config. The only problem was that the configuration was already used in the commands configure. So I had to parse the option before the commands init, thats why it already checks for --config in the Application constructor. |
There are some issues in CI https://github.com/crunzphp/crunz/actions/runs/3411655638/jobs/5743651750, also please revert "style" changes. |
@@ -15,7 +15,7 @@ | |||
|
|||
final class ConfigGeneratorCommand extends Command | |||
{ | |||
public const CONFIG_FILE_NAME = 'crunz.yml'; | |||
public static string $CONFIG_FILE_NAME = 'crunz.yml'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be better to leave that constant as is and create new parameter in container.
|
||
$configFileName = ConfigGeneratorCommand::$CONFIG_FILE_NAME; | ||
|
||
$configPath = Path::fromStrings($cwd ?? '', $configFileName)->toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to provide absolute path?
|
||
$this->add($command); | ||
} | ||
} | ||
|
||
public function run(InputInterface $input = null, OutputInterface $output = null): int | ||
{ | ||
// Add config option to all commands | ||
$this->getDefinition()->addOptions([ | ||
new InputOption( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing tests for new --config
option.
This makes it posible to define an alternative location for your config file. For example you want it inside a config folder or outside your project root.
Simply define the env variable CRUNZ_CONFIG in your environment or export before executing the command:
ie: export CRUNZ_CONFIG=config/crunz.yml && php vendor/bin/crunz