Skip to content

Commit

Permalink
fix aws bucket credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
andreciornavei committed Mar 8, 2024
1 parent a5e26f2 commit 0885d77
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ jobs:
echo "DB_URI=${DB_URI}" >> .env
echo "JWT_SECRET=${JWT_SECRET}" >> .env
echo "AWS_HOSTED_ZONE_ID=${AWS_HOSTED_ZONE_ID}" >> .env
echo "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" >> .env
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> .env
echo "AWS_BUCKET_KEY=${AWS_ACCESS_KEY_ID}" >> .env
echo "AWS_BUCKET_SECRET=${AWS_SECRET_ACCESS_KEY}" >> .env
serverless deploy --config serverless.yml --stage ${BRANCH} --region ${AWS_DEFAULT_REGION} --verbose
if: success()

Expand Down
6 changes: 3 additions & 3 deletions backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DB_URI=
JWT_SECRET=

AWS_BUCKET=
AWS_REGION=sa-east-1
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_BUCKET_REGION=sa-east-1
AWS_BUCKET_KEY=
AWS_BUCKET_SECRET=
AWS_USE_PATH_STYLE_ENDPOINT=false
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class AwsS3Provider implements IStorageProvider
public function __construct()
{
$args = [
'region' => env('AWS_REGION', "sa-east-1"),
'region' => env('AWS_BUCKET_REGION', "sa-east-1"),
'version' => 'latest',
];
if (getenv("AWS_ACCESS_KEY_ID") && getenv("AWS_SECRET_ACCESS_KEY")) {
if (getenv("AWS_BUCKET_KEY") && getenv("AWS_BUCKET_SECRET")) {
$args["credentials"] = new Credentials(
env('AWS_ACCESS_KEY_ID'),
env('AWS_SECRET_ACCESS_KEY'),
env('AWS_BUCKET_KEY'),
env('AWS_BUCKET_SECRET'),
);
}
$sdk = new Sdk($args);
Expand Down
10 changes: 5 additions & 5 deletions backend/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ params:
AWS_HOSTED_ZONE_ID: ${env:AWS_HOSTED_ZONE_ID}
SUBDOMAIN: ${env:SUBDOMAIN}.${sls:stage}.${env:DOMAIN}
BUCKET_NAME: bnb-bank-upload.${sls:stage}.${env:DOMAIN}
AWS_ACCESS_KEY_ID: ${env:AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${env:AWS_SECRET_ACCESS_KEY}
AWS_BUCKET_KEY: ${env:AWS_BUCKET_KEY}
AWS_BUCKET_SECRET: ${env:AWS_BUCKET_SECRET}
production:
SUBDOMAIN: ${env:SUBDOMAIN}.${env:DOMAIN}
BUCKET_NAME: bnb-bank-upload.${env:DOMAIN}
Expand Down Expand Up @@ -66,9 +66,9 @@ functions:
APP_NAME: ${param:APP_NAME}
DB_URI: ${param:DB_URI}
AWS_BUCKET: ${param:BUCKET_NAME}
AWS_REGION: ${param:REGION}
AWS_ACCESS_KEY_ID: ${param:AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${param:AWS_SECRET_ACCESS_KEY}
AWS_BUCKET_REGION: ${param:REGION}
AWS_BUCKET_KEY: ${param:AWS_BUCKET_KEY}
AWS_BUCKET_SECRET: ${param:AWS_BUCKET_SECRET}
AWS_USE_PATH_STYLE_ENDPOINT: false
JWT_SECRET: ${param:JWT_SECRET}
events:
Expand Down

0 comments on commit 0885d77

Please sign in to comment.