Skip to content

Commit ab82861

Browse files
authored
Merge pull request #229 from buggregator/feature/228
Add support for both `yaml` and `yml` file extensions.
2 parents 15a57b7 + a9707fd commit ab82861

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

app/database/Migrations/20240728.115465_1_1_default_create_default_project.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ class OrmDefaultD93e77c9f5556975e93bfbc969442732 extends Migration
1717

1818
public function up(): void
1919
{
20+
$defaultProject = $this->getRepository()->findOne(['key' => Project::DEFAULT_KEY]);
21+
22+
// Ignore if default project already exists
23+
if ($defaultProject !== null) {
24+
return;
25+
}
26+
2027
$this->getEntityManager()
2128
->persist(new Project(Key::create(Project::DEFAULT_KEY), 'Default project'))
2229
->run();
@@ -25,6 +32,7 @@ public function up(): void
2532
public function down(): void
2633
{
2734
$defaultProject = $this->getRepository()->findOne(['key' => Project::DEFAULT_KEY]);
35+
// Delete default project if exists
2836
if ($defaultProject !== null) {
2937
$this->getEntityManager()->delete($defaultProject)->run();
3038
}

app/modules/Projects/Application/YamlFileProjectLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(
2222

2323
public function findAll(): iterable
2424
{
25-
$this->finder->files()->in($this->directory)->name('*.project.yaml');
25+
$this->finder->files()->in($this->directory)->name(['*.project.yaml', '*.project.yml']);
2626

2727
foreach ($this->finder as $file) {
2828
try {

app/modules/Webhooks/Application/WebhooksBootloader.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@ public function defineSingletons(): array
7878
finder: \Symfony\Component\Finder\Finder::create()
7979
->files()
8080
->in($dirs->get('runtime') . '/configs')
81-
->name('*.webhook.yaml'),
81+
->name(['*.webhook.yaml', '*.webhook.yml']),
8282
),
8383
],
8484
),
8585

86-
WebhookLocatorInterface::class => static fn(YamlFileWebhookLocator $locator): WebhookLocatorInterface => new CompositeWebhookLocator([
86+
WebhookLocatorInterface::class => static fn(
87+
YamlFileWebhookLocator $locator,
88+
): WebhookLocatorInterface => new CompositeWebhookLocator([
8789
$locator,
8890
]),
8991

0 commit comments

Comments
 (0)