Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update S3Provider.php #65

Merged
merged 3 commits into from
Apr 30, 2024
Merged

Update S3Provider.php #65

merged 3 commits into from
Apr 30, 2024

Conversation

lonnylot
Copy link
Contributor

Update S3 to implement correct Updater interface

I wasn't sure if the env vars were added to the binary so I migrated from using AWS keys / secret to a profile

Update S3 to implement correct `Updater` interface

I wasn't sure if the env vars were added to the binary so I migrated from using AWS keys / secret to a profile
lonnylot added a commit to lonnylot/laravel that referenced this pull request Jul 31, 2023
Updated S3 config to be in line with NativePHP/electron#65
@shanerbaner82
Copy link

I had to add the following for the environmentVariables method:

public function environmentVariables(): array
    {
        return [
            'AWS_ACCESS_KEY_ID' => $this->config['key'],
            'AWS_SECRET_ACCESS_KEY' => $this->config['secret'],
        ];
    }

@lonnylot
Copy link
Contributor Author

lonnylot commented Aug 3, 2023

I had to add the following for the environmentVariables method:

public function environmentVariables(): array
    {
        return [
            'AWS_ACCESS_KEY_ID' => $this->config['key'],
            'AWS_SECRET_ACCESS_KEY' => $this->config['secret'],
        ];
    }

I purposely left out the key / secret and only used the profile. You can set the profile on the CLI and it will map to the credentials w/o passing them through the build process.

@nexxai
Copy link

nexxai commented Aug 7, 2023

Really hoping this can get merged soon

@mpociot or @simonhamp - can one of you look at this? Without the methods in this PR, you cannot build for S3.

simonhamp

This comment was marked as duplicate.

Copy link
Member

@simonhamp simonhamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, but I must confess I know very little about S3 and don't have an account to test on.

I'm also not aware of how the electron-builder module expects these parameters.

It might be nice to add some comments to the Updater interface explaining how these parameters are used, as it feels like more drivers for this could come in the future.

@saeedvaziry
Copy link

Facing this error with these changes

Undefined array key "acl"

@lonnylot
Copy link
Contributor Author

Facing this error with these changes

Undefined array key "acl"

See this PR: NativePHP/laravel#90

@nexxai
Copy link

nexxai commented Aug 10, 2023

The KEY and SECRET are definitely available and so they should probably be used for consistency purposes. Not everyone will have a profile set up (think: CI runners who are just building the app and have the key and secret injected at run time).

@lonnylot
Copy link
Contributor Author

The KEY and SECRET are definitely available and so they should probably be used for consistency purposes. Not everyone will have a profile set up (think: CI runners who are just building the app and have the key and secret injected at run time).

The KEY and SECRET were specifically not used because they were compiled in to the release. They can all be added back in as optional params, but I wouldn't recommend taking the risk.

This PR is approved days ago so I'm not really sure how to move forward.

Any guidance would be appreciated.

@nexxai
Copy link

nexxai commented Aug 10, 2023

They've been approved but nothing has happened yet, so don't feel locked in place. If there's room for improvement, take the opportunity. Nothing has been merged so until that happens, make all the changes you want.

@simonhamp
Copy link
Member

NativePHP/laravel#90 was closed as it doesn't feel like the right solution to that problem.

As long as your AWS_* env keys are passed either via the command line or stored in your .env file, they will not be compiled into your application.

Also worth noting that Electron's native updater has a default acl of public-read, which is what NativePHP uses under the hood as I understand it (I'm still learning Electron).

@lonnylot Please could you clean up this PR when you get a chance?

@simonhamp simonhamp self-requested a review April 28, 2024 19:25
Copy link
Member

@simonhamp simonhamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment

@lonnylot
Copy link
Contributor Author

@simonhamp I'll get to it ASAP, but I'm fairly busy now. Wouldn't be offended if someone else made the adjustments.

src/Updater/S3Provider.php Outdated Show resolved Hide resolved
src/Updater/S3Provider.php Outdated Show resolved Hide resolved
lonnylot and others added 2 commits April 29, 2024 08:04
Co-authored-by: Simon Hamp <simon.hamp@me.com>
Co-authored-by: Simon Hamp <simon.hamp@me.com>
@simonhamp simonhamp merged commit 3a9f93b into NativePHP:main Apr 30, 2024
1 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants