Skip to content

Commit 4449ed0

Browse files
authored
Modify service provider to use different config for publishing and default usage (#149)
1 parent 16f12cb commit 4449ed0

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

config/aws_default.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
use Aws\Laravel\AwsServiceProvider;
4+
5+
return [
6+
7+
/*
8+
|--------------------------------------------------------------------------
9+
| AWS SDK Configuration
10+
|--------------------------------------------------------------------------
11+
|
12+
| The configuration options set in this file will be passed directly to the
13+
| `Aws\Sdk` object, from which all client objects are created. This file
14+
| sets the default minimum configuration used by the service provider even
15+
| if no configuration is set by the user. The full set of possible options
16+
| are documented at:
17+
| http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/configuration.html
18+
|
19+
*/
20+
'region' => env('AWS_REGION', 'us-east-1'),
21+
'version' => 'latest',
22+
'ua_append' => [
23+
'L5MOD/' . AwsServiceProvider::VERSION,
24+
],
25+
];

config/aws.php renamed to config/aws_publish.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
|--------------------------------------------------------------------------
1111
|
1212
| The configuration options set in this file will be passed directly to the
13-
| `Aws\Sdk` object, from which all client objects are created. The minimum
14-
| required options are declared here, but the full set of possible options
15-
| are documented at:
13+
| `Aws\Sdk` object, from which all client objects are created. This file
14+
| is published to the application config directory for modification by the
15+
| user. The full set of possible options are documented at:
1616
| http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/configuration.html
1717
|
1818
*/

src/AwsServiceProvider.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ class AwsServiceProvider extends ServiceProvider
2626
*/
2727
public function boot()
2828
{
29-
$source = dirname(__DIR__).'/config/aws.php';
30-
3129
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
32-
$this->publishes([$source => config_path('aws.php')]);
30+
$this->publishes([
31+
dirname(__DIR__).'/config/aws_publish.php' => config_path('aws.php')
32+
]);
3333
} elseif ($this->app instanceof LumenApplication) {
3434
$this->app->configure('aws');
3535
}
3636

37-
$this->mergeConfigFrom($source, 'aws');
37+
$this->mergeConfigFrom(dirname(__DIR__).'/config/aws_default.php', 'aws');
3838
}
3939

4040
/**

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy