Coder Social home page Coder Social logo

Cached config about laravel-zipstream HOT 9 CLOSED

stechstudio avatar stechstudio commented on August 22, 2024
Cached config

from laravel-zipstream.

Comments (9)

ianrothmann avatar ianrothmann commented on August 22, 2024 1

Dear @jszobody,

It works like a charm. Thanks for your great work on this package!

from laravel-zipstream.

jszobody avatar jszobody commented on August 22, 2024

Hmm I wanted the AWS credentials to be handled by the underlying aws-sdk-php package. It looks like I should be creating the S3Client from the pre-wired SDK there.

Can you trying this in S3File real quick:

    public function getS3Client(): S3Client
    {
        if (!$this->client) {
            $this->client = resolve('aws')->createClient('s3', [
                'region' => $this->getRegion(),
                'version' => '2006-03-01'
            ]);
        }
        return $this->client;
    }

That should use the already configured AWS credentials, and merge the specific S3 region for this file (which may or may not match the default region configured).

I'd prefer to use these default configured credentials rather than storing separate ones just for this package, if possible.

from laravel-zipstream.

bubba-h57 avatar bubba-h57 commented on August 22, 2024

If you relied on https://github.com/aws/aws-sdk-php-laravel then you could simply

$s3 = App::make('aws')->createClient('s3');

or

$s3 = AWS::createClient('s3');

Push handling it even further down the chain of command.

from laravel-zipstream.

jszobody avatar jszobody commented on August 22, 2024

I should really be using S3MultiRegionClient for S3, would simplify this a lot.

from laravel-zipstream.

ambdisp avatar ambdisp commented on August 22, 2024

Thanks for your answers. I appreciate it.
Just a note
All suggestions work once aws/aws-sdk-php-laravel is installed.
Before I had only aws/aws-sdk-php.

from laravel-zipstream.

bubba-h57 avatar bubba-h57 commented on August 22, 2024

Excellent!

from laravel-zipstream.

ianrothmann avatar ianrothmann commented on August 22, 2024

Hi there!

Still having config issues. it works locally, but not on my Laravel Forge managed server. I've goy aws-sdk-php-laravel installed and configured.

Why not just add the key and secret to the config and use it to instantiate the client if it exists? It would simplify setup a lot.

from laravel-zipstream.

jszobody avatar jszobody commented on August 22, 2024

@ianrothmann I just pushed this change, can you try it out? I'm not in a position to test it at the moment. Update your composer.json to use dev-master to get this un-released change, I want to verify it's all working before I release it.

from laravel-zipstream.

jszobody avatar jszobody commented on August 22, 2024

@ambdisp and @ianrothmann This is now done. Version 1.5 caches AWS credentials in the package config file, and will work without the aws/aws-sdk-php-laravel specific package. (You still need aws/aws-sdk-php of course).

from laravel-zipstream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.