overtrue / laravel-filesystem-cos

Tencent Cloud COS storage for Laravel based on overtrue/flysystem-cos.
MIT License
89 stars 8 forks source link

cos 配置写死了,若项目有多个bucket就没法搞了 #8

Closed wmlc closed 3 years ago

wmlc commented 3 years ago

服务提供器 boot方法

    public function boot()
    {
        Storage::extend('cos', function () {
            $adapter = new CosAdapter(\config('filesystems.disks.cos'));

            $filesystem = new Filesystem($adapter);
            $filesystem->addPlugin(new FileUrl());
            $filesystem->addPlugin(new FileSignedUrl());

            return $filesystem;
        });
    }

$adapter = new CosAdapter(\config('filesystems.disks.cos'));

这行代码cos配置写死了,能不能写活一下

根据disk()方法设置的驱动来配置

如:

Storage::extend('cos', function ($app, $config) {  
            $adapter = new CosAdapter($config);
overtrue commented 3 years ago

你可以自己注册多个服务的,这么写是因为大部分项目是一个桶

wmlc commented 3 years ago

你可以自己注册多个服务的,这么写是因为大部分项目是一个桶

也可以 试了下没问题了

overtrue commented 3 years ago

好嘞,有问题随时反馈哈

wml @.***>于2021年11月7日 周日下午4:53写道:

你可以自己注册多个服务的,这么写是因为大部分项目是一个桶

也可以 试了下没问题了

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/overtrue/laravel-filesystem-cos/issues/8#issuecomment-962573527, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALHOYGE3QMILOFQQEUJ4U3UKY5BFANCNFSM5HPLI6BA .