Skip to content

Commit bd616f1

Browse files
Merge pull request #2 from stackkit/development
Development
2 parents b8fbac2 + 0a0f605 commit bd616f1

9 files changed

+25
-39
lines changed

.github/workflows/run-tests.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
strategy:
1313
matrix:
1414
php: [7.4, 7.3, 7.2]
15-
laravel: [7.*, 6.*, 5.8.*, 5.7.*, 5.6.*]
15+
laravel: [8.*, 7.*, 6.*, 5.8.*, 5.7.*, 5.6.*]
1616
os: [ubuntu-latest]
1717
include:
18+
- laravel: 8.*
19+
testbench: 6.*
1820
- laravel: 7.*
1921
testbench: 5.*
2022
- laravel: 6.*
@@ -26,6 +28,8 @@ jobs:
2628
- laravel: 5.6.*
2729
testbench: 3.6.*
2830
exclude:
31+
- laravel: 8.*
32+
php: 7.2
2933
- laravel: 5.7.*
3034
php: 7.4
3135
- laravel: 5.6.*

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## 2.0.0 - 2020-10-11
8+
9+
**Added**
10+
11+
- Support for Laravel 8
12+
13+
**Changed**
14+
15+
- Change authentication method from config value path to Application Default Standard
16+
717
## 1.0.0 - 2020-06-20
818

919
**Added**

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Please check the table below for supported Laravel and PHP versions:
3535
| 5.8 | 7.2 or 7.3 or 7.4
3636
| 6.x | 7.2 or 7.3 or 7.4
3737
| 7.x | 7.2 or 7.3 or 7.4
38+
| 8.x | 7.3 or 7.4
3839

3940
# Installation
4041

@@ -52,7 +53,6 @@ composer require stackkit/laravel-google-cloud-tasks-queue
5253
```
5354
'cloudtasks' => [
5455
'driver' => 'cloudtasks',
55-
'credentials' => base_path('gcloud-key.json'),
5656
'project' => env('STACKKIT_CLOUD_TASKS_PROJECT', ''),
5757
'location' => env('STACKKIT_CLOUD_TASKS_LOCATION', ''),
5858
'handler' => env('STACKKIT_CLOUD_TASKS_HANDLER', ''),
@@ -85,6 +85,12 @@ Please check the table below on what the values mean and what their value should
8585
|`STACKKIT_CLOUD_TASKS_QUEUE`|The queue a job will be added to|`emails`
8686
|`STACKKIT_CLOUD_TASKS_SERVICE_EMAIL`|The email address of the AppEngine service account. Important, it should have the *Cloud Tasks Enqueuer* role. This is used for securing the handler.|`[email protected]`
8787

88+
# Authentication
89+
90+
Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable with a path to the credentials file.
91+
92+
More info: https://cloud.google.com/docs/authentication/production
93+
8894
# Configuring the queue
8995

9096
When you first create a queue using `gcloud tasks queues create`, the default settings will look something like this:

phpunit.xml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<env name="SESSION_DRIVER" value="array"/>
2323
<env name="MAIL_DRIVER" value="log"/>
2424
<env name="QUEUE_DRIVER" value="cloudtasks"/>
25+
<env name="GOOGLE_APPLICATION_CREDENTIALS" value="./tests/Support/gcloud-key-valid.json" />
2526
</php>
2627

2728
<filter>

src/CloudTasksServiceProvider.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ public function boot(QueueManager $queue, Router $router)
1919
private function registerClient()
2020
{
2121
$this->app->singleton(CloudTasksClient::class, function () {
22-
return new CloudTasksClient([
23-
'credentials' => Config::credentials(),
24-
]);
22+
return new CloudTasksClient();
2523
});
2624
}
2725

src/Config.php

-8
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ public static function serviceAccountEmail()
3333

3434
public static function validate(array $config)
3535
{
36-
if (empty($config['credentials'])) {
37-
throw new Error(Errors::invalidCredentials());
38-
}
39-
40-
if (!file_exists($config['credentials'])) {
41-
throw new Error(Errors::credentialsFileDoesNotExist());
42-
}
43-
4436
if (empty($config['project'])) {
4537
throw new Error(Errors::invalidProject());
4638
}

tests/ConfigTest.php

-22
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,6 @@
88

99
class ConfigTest extends TestCase
1010
{
11-
/** @test */
12-
public function credentials_are_required()
13-
{
14-
$this->setConfigValue('credentials', '');
15-
16-
$this->expectException(Error::class);
17-
$this->expectExceptionMessage(Errors::invalidCredentials());
18-
19-
SimpleJob::dispatch();
20-
}
21-
22-
/** @test */
23-
public function credentials_file_must_exist()
24-
{
25-
$this->setConfigValue('credentials', 'doesnotexist.json');
26-
27-
$this->expectException(Error::class);
28-
$this->expectExceptionMessage(Errors::credentialsFileDoesNotExist());
29-
30-
SimpleJob::dispatch();
31-
}
32-
3311
/** @test */
3412
public function project_is_required()
3513
{

tests/TaskHandlerTest.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ protected function setUp(): void
4545
$googlePublicKey->shouldReceive('getKidFromOpenIdToken')->andReturnNull();
4646

4747
$this->handler = new TaskHandler(
48-
new CloudTasksClient([
49-
'credentials' => __DIR__ . '/Support/gcloud-key-valid.json'
50-
]),
48+
new CloudTasksClient(),
5149
request(),
5250
$this->jwt,
5351
$googlePublicKey

tests/TestCase.php

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ protected function getEnvironmentSetUp($app)
3232
$app['config']->set('queue.default', 'cloudtasks');
3333
$app['config']->set('queue.connections.cloudtasks', [
3434
'driver' => 'cloudtasks',
35-
'credentials' => __DIR__ . '/Support/gcloud-key-valid.json',
3635
'queue' => 'test-queue',
3736
'project' => 'test-project',
3837
'location' => 'europe-west6',

0 commit comments

Comments
 (0)