Skip to content

Commit

Permalink
Fixed references to config in s3 driver. Added missing credential con…
Browse files Browse the repository at this point in the history
…fig in dev materia config.
  • Loading branch information
clpetersonucf committed Jul 31, 2024
1 parent 5e495a3 commit 1f263ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions fuel/app/classes/materia/widget/asset/storage/s3.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,12 @@ protected function get_s3_client(): \Aws\S3\S3Client
'token' => static::$_config['token'] ?? null,
]
];
if ($_config['credential_provider'] == 'imds')
if (static::$_config['credential_provider'] == 'imds')
{
$provider = \Aws\Credentials\CredentialProvider::defaultProvider();
$config['credentials'] = $provider;
}
elseif ($_config['credential_provider'] == 'env')
elseif (static::$_config['credential_provider'] == 'env')
{
$config['credentials'] = [
'key' => static::$_config['key'],
Expand Down
19 changes: 10 additions & 9 deletions fuel/app/config/development/materia.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@
(($_ENV['ASSET_STORAGE_DRIVER'] ?? 'file') == 's3')
? [
'driver_class' => '\Materia\Widget_Asset_Storage_S3',
'endpoint' => $_ENV['ASSET_STORAGE_S3_ENDPOINT'] ?? 'http://fakes3:10001', // set to url for testing endpoint
'region' => $_ENV['ASSET_STORAGE_S3_REGION'] ?? 'us-east-1', // aws region for bucket
'bucket' => $_ENV['ASSET_STORAGE_S3_BUCKET'] ?? 'fake_bucket', // bucket to store original user uploads
'subdir' => $_ENV['ASSET_STORAGE_S3_BASEPATH'] ?? 'media', // OPTIONAL - directory to store original and resized assets
'secret_key' => $_ENV['AWS_SECRET_ACCESS_KEY'] ?? $_ENV['ASSET_STORAGE_S3_SECRET'] ?? 'SECRET', // aws api secret key
'key' => $_ENV['AWS_ACCESS_KEY_ID'] ?? $_ENV['ASSET_STORAGE_S3_KEY'] ?? 'KEY', // aws api key
'token' => $_ENV['AWS_SESSION_TOKEN'] ?? 'TOKEN', // aws session token
'force_path_style' => $_ENV['ASSET_STORAGE_S3_FORCE_PATH_STYLE'] ?? false, // needed for fakes3
'fakes3_enabled' => $_ENV['DEV_ONLY_FAKES3_DISABLED'] ?? true, // using fakes3 unless explicitly disabled
'credential_provider' => $_ENV['ASSET_STORAGE_S3_CREDENTIAL_PROVIDER'] ?? 'env', // env or imds. Should be set to env for fakes3
'endpoint' => $_ENV['ASSET_STORAGE_S3_ENDPOINT'] ?? 'http://fakes3:10001', // set to url for testing endpoint
'region' => $_ENV['ASSET_STORAGE_S3_REGION'] ?? 'us-east-1', // aws region for bucket
'bucket' => $_ENV['ASSET_STORAGE_S3_BUCKET'] ?? 'fake_bucket', // bucket to store original user uploads
'subdir' => $_ENV['ASSET_STORAGE_S3_BASEPATH'] ?? 'media', // OPTIONAL - directory to store original and resized assets
'secret_key' => $_ENV['AWS_SECRET_ACCESS_KEY'] ?? $_ENV['ASSET_STORAGE_S3_SECRET'] ?? 'SECRET', // aws api secret key
'key' => $_ENV['AWS_ACCESS_KEY_ID'] ?? $_ENV['ASSET_STORAGE_S3_KEY'] ?? 'KEY', // aws api key
'token' => $_ENV['AWS_SESSION_TOKEN'] ?? 'TOKEN', // aws session token
'force_path_style' => $_ENV['ASSET_STORAGE_S3_FORCE_PATH_STYLE'] ?? false, // needed for fakes3
'fakes3_enabled' => $_ENV['DEV_ONLY_FAKES3_DISABLED'] ?? true, // using fakes3 unless explicitly disabled
]
: null
),
Expand Down

0 comments on commit 1f263ea

Please sign in to comment.