Skip to content

Commit

Permalink
Fix up all config variables
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioribeiro committed Sep 22, 2024
1 parent 4759c79 commit 4e13164
Show file tree
Hide file tree
Showing 17 changed files with 345 additions and 340 deletions.
22 changes: 10 additions & 12 deletions config/classes.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<?php

return [
/**
* Service classes
*
* Supported CDN services: Akamai, CloudFront
*
*/
'classes' => [
'cdn' => A17\EdgeFlush\Services\CloudFront\Service::class,
/**
* Service classes
*
* Supported CDN services: Akamai, CloudFront
*
*/
'cdn' => A17\EdgeFlush\Services\CloudFront\Service::class,

'cache-control' => A17\EdgeFlush\Services\CacheControl::class,
'cache-control' => A17\EdgeFlush\Services\CacheControl::class,

'tags' => A17\EdgeFlush\Services\Tags::class,
'tags' => A17\EdgeFlush\Services\Tags::class,

'warmer' => A17\EdgeFlush\Services\Warmer::class,
],
'warmer' => A17\EdgeFlush\Services\Warmer::class,
];
18 changes: 8 additions & 10 deletions config/domains.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
use A17\EdgeFlush\Support\Helpers;

return [
/**
* Only allowed domains will have tags stored.
* An empty array will allow all domains.
*/
'domains' => [
'allowed' => [
Helpers::parseUrl(env('APP_URL'))['host']
],

'blocked' => []
/**
* Only allowed domains will have tags stored.
* An empty array will allow all domains.
*/
'allowed' => [
Helpers::parseUrl(env('APP_URL'))['host']
],

'blocked' => []
];
2 changes: 1 addition & 1 deletion config/frontend-checker.php → config/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
* 'frontend-checker' => true,
*
*/
'frontend-checker' => A17\EdgeFlush\Services\FrontendChecker::class,
'checker' => A17\EdgeFlush\Services\FrontendChecker::class,
];
294 changes: 146 additions & 148 deletions config/invalidations.php
Original file line number Diff line number Diff line change
@@ -1,178 +1,176 @@
<?php

return [
/**
* Invalidations.
*
* Invalidations can be sent one by one or in batch. In this section you can configure
* this and also set the limits.
*
* method:
* invalidate: tell CDN to invalidate the page
* delete: tell CDN to delete the page
*
* type:
* single: invalidations are executed immediately after a model is updated.
* batch: invalidations are executed every x minutes.
*
* batch:
* size: How many invalidations should be sent every time we invalidate?
* flush_roots_if_exceeds: If there are more than this, we should just invalidate the whole site
* roots: What are the paths to invalidate "the whole site"?
*/
'method' => 'invalidate', // invalidate, delete

'type' => 'batch', // single, batch

'batch' => [
'size' => 2999, /// urls

'flush_roots_if_exceeds' => 15000,

'roots' => ['/*'],
],

/**
* Invalidations.
*
* Invalidations can be sent one by one or in batch. In this section you can configure
* this and also set the limits.
*
* method:
* invalidate: tell CDN to invalidate the page
* delete: tell CDN to delete the page
*
* type:
* single: invalidations are executed immediately after a model is updated.
* batch: invalidations are executed every x minutes.
*
* batch:
* size: How many invalidations should be sent every time we invalidate?
* flush_roots_if_exceeds: If there are more than this, we should just invalidate the whole site
* roots: What are the paths to invalidate "the whole site"?
* Ignore certain attributes when invalidating or creating tags
*/
'invalidations' => [
'method' => 'invalidate', // invalidate, delete

'type' => 'batch', // single, batch

'batch' => [
'size' => 2999, /// urls
'attributes' => [
'ignore' => [
'*' => ['id', 'locale', 'localMacros', 'without'],

'flush_roots_if_exceeds' => 15000,

'roots' => ['/*'],
'App\Models\Translations\EventTranslation' => ['event_id']
],
'always-add' => [
'*' => ['published']
],
],

/**
* Ignore certain attributes when invalidating or creating tags
*/
'attributes' => [
'ignore' => [
'*' => ['id', 'locale', 'localMacros', 'without'],
'crud-strategy' => [
'updated' => [
/**
* Default behaviour if model not specified
*
* invalidate-dependents: invalidate paths that depends of this model and attribute
* invalidate-all: invalidate all paths
* invalidate-none: don't do anything
*/
'default' => 'invalidate-dependents', // invalidate-dependents, invalidate-all, invalidate-none

/**
* We can setup specific behaviour for each model, depending on how their attributes changes
*
* Let's say you have a listing on your site that shows all the posts on a page when you publish them.
* If you create a new post unpublished, your pages should not be invalidated because this new post
* would not appear on a page. But if you publish it, your pages should be invalidated.
*/
'when-models' => [
[
/**
* List of models
*/
'models' => [
'App\Models\Artwork',
'App\Models\Event',
],

'App\Models\Translations\EventTranslation' => ['event_id']
],
'always-add' => [
'*' => ['published']
],
],
/**
* When a particular attribute changes
*/
'on-change' => [
'published' => true, // attribute changed to "true"
],

'crud-strategy' => [
'updated' => [
/**
* Default behaviour if model not specified
*
* invalidate-dependents: invalidate paths that depends of this model and attribute
* invalidate-all: invalidate all paths
* invalidate-none: don't do anything
*/
'default' => 'invalidate-dependents', // invalidate-dependents, invalidate-all, invalidate-none

/**
* We can setup specific behaviour for each model, depending on how their attributes changes
*
* Let's say you have a listing on your site that shows all the posts on a page when you publish them.
* If you create a new post unpublished, your pages should not be invalidated because this new post
* would not appear on a page. But if you publish it, your pages should be invalidated.
*/
'when-models' => [
[
/**
* List of models
*/
'models' => [
'App\Models\Artwork',
'App\Models\Event',
],

/**
* When a particular attribute changes
*/
'on-change' => [
'published' => true, // attribute changed to "true"
],

/**
* Invalidate the whole site
*
* TODO: should we tell which pages to invalidate here?
*/
'strategy' => 'invalidate-all',
/**
* Invalidate the whole site
*
* TODO: should we tell which pages to invalidate here?
*/
'strategy' => 'invalidate-all',
],
[
'models' => [
A17\EdgeFlush\Models\Url::class,
A17\EdgeFlush\Models\Tag::class,
],
[
'models' => [
A17\EdgeFlush\Models\Url::class,
A17\EdgeFlush\Models\Tag::class,
],

'strategy' => 'invalidate-none',
]
'strategy' => 'invalidate-none',
]
],
]
],

'created' => [
/**
* If when-model condition is not met, we don't do anything
*/
'default' => 'invalidate-none',

'when-models' => [
[
'models' => [
'App\Models\Person',
],

/**
* If we are creating a new person, already published, we should invalidate the whole site
*/
'on-change' => [
'published' => true, // attribute changed to "true"
],

'strategy' => 'invalidate-all',
'created' => [
/**
* If when-model condition is not met, we don't do anything
*/
'default' => 'invalidate-none',

'when-models' => [
[
'models' => [
'App\Models\Person',
],
[
'models' => [
A17\EdgeFlush\Models\Url::class,
A17\EdgeFlush\Models\Tag::class,
],

'strategy' => 'invalidate-none',
]
],
],
/**
* If we are creating a new person, already published, we should invalidate the whole site
*/
'on-change' => [
'published' => true, // attribute changed to "true"
],

'deleted' => [
/**
* Anything deleted on the website invalidates the whole site
*/
'default' => 'invalidate-all',
'strategy' => 'invalidate-all',
],
[
'models' => [
A17\EdgeFlush\Models\Url::class,
A17\EdgeFlush\Models\Tag::class,
],

'when-models' => [
[
'models' => [
A17\EdgeFlush\Models\Url::class,
A17\EdgeFlush\Models\Tag::class,
],
'strategy' => 'invalidate-none',
]
],
],

'strategy' => 'invalidate-none',
'deleted' => [
/**
* Anything deleted on the website invalidates the whole site
*/
'default' => 'invalidate-all',

'when-models' => [
[
'models' => [
A17\EdgeFlush\Models\Url::class,
A17\EdgeFlush\Models\Tag::class,
],

'strategy' => 'invalidate-none',
],
],
],

'pivot-synced' => [
/**
* Anything deleted on the website invalidates the whole site
*/
'default' => 'invalidate-dependents',
],
'pivot-synced' => [
/**
* Anything deleted on the website invalidates the whole site
*/
'default' => 'invalidate-dependents',
],

'on-all-events' => [
/**
* On all events, also invalidate those
*/
'default' => 'invalidate-none',
'on-all-events' => [
/**
* On all events, also invalidate those
*/
'default' => 'invalidate-none',

'when-models' => [
[
'models' => ['*'],
'when-models' => [
[
'models' => ['*'],

'strategy' => 'invalidate-urls',
'strategy' => 'invalidate-urls',

'urls' => [
'%sitemap.xml%',
]
],
'urls' => [
'%sitemap.xml%',
]
],
],
],
Expand Down
2 changes: 1 addition & 1 deletion config/responses.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Allowed responses
*/
'responses' => [
'types' => [
'cachable' => [
Illuminate\Http\Response::class,
Illuminate\Http\JsonResponse::class,
Expand Down
File renamed without changes.
Loading

0 comments on commit 4e13164

Please sign in to comment.