Skip to content

Commit e2f84df

Browse files
committed
Use env() in config file
1 parent ffdabb6 commit e2f84df

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

config/config.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@
3636
|
3737
*/
3838

39-
'enabled-environments' => [
40-
'production',
41-
],
39+
'enabled-environments' => array_filter(explode(',', env('AWS_SECRETS_ENABLED_ENV', 'production'))),
4240

4341
/*
4442
|--------------------------------------------------------------------------
@@ -48,10 +46,19 @@
4846
| Some (not all) variables are set into the config, as such updating the env() will not overwrite
4947
| the config cached values. The variables below will overwrite the config.
5048
|
49+
| Example:
50+
| .env
51+
| VARIABLES_CONFIG_KEYS=APP_KEY:app.key,OTHER_KEY:app.other_key
52+
|
5153
*/
52-
'variables-config' => [
53-
'APP_KEY' => 'app.key',
54-
],
54+
55+
'variables-config' => collect(array_filter(explode(',', env('AWS_SECRETS_VARIABLES_CONFIGS', ''))))
56+
->mapWithKeys(function ($pair) {
57+
[$envKey, $configKey] = explode(':', $pair);
58+
59+
return [$envKey => $configKey];
60+
})
61+
->toArray(),
5562

5663
/*
5764
|--------------------------------------------------------------------------
@@ -63,7 +70,7 @@
6370
|
6471
*/
6572

66-
'cache-enabled' => true, // boolean
73+
'cache-enabled' => env('AWS_SECRETS_CACHE_ENABLED', true),
6774

6875
/*
6976
|--------------------------------------------------------------------------
@@ -74,7 +81,7 @@
7481
|
7582
*/
7683

77-
'cache-expiry' => 30, // minutes
84+
'cache-expiry' => env('AWS_SECRETS_CACHE_EXPIRY', 30),
7885

7986
/*
8087
|--------------------------------------------------------------------------
@@ -86,7 +93,7 @@
8693
|
8794
*/
8895

89-
'cache-store' => 'file',
96+
'cache-store' => env('AWS_SECRETS_CACHE_STORE', 'file'),
9097

9198
/*
9299
|--------------------------------------------------------------------------

src/LaravelAwsSecretsManager.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ class LaravelAwsSecretsManager
1515
protected $cacheExpiry;
1616
protected $cacheStore;
1717
protected $debug;
18-
protected $enabledEnvironments;
19-
protected $listTag;
18+
protected array $enabledEnvironments;
19+
protected bool $keyRotation;
20+
protected string $listTagName = '';
21+
protected string $listTagValue = '';
2022

2123
public function __construct()
2224
{

0 commit comments

Comments
 (0)