creocoder / yii2-flysystem

The Flysystem integration for the Yii framework.
Other
283 stars 76 forks source link

added Google Cloud Filesystem #32

Closed schmunk42 closed 6 years ago

gusev-genotek commented 7 years ago

Kindly asking to merge this feature into master. Exactly what I need right now.

razvanphp commented 5 years ago

Automatic authentication in google app engine does not work because of throw new InvalidConfigException in init(): documentation.

  • If running in Google App Engine, the built-in service account associated with the application will be used.
  • If running in Google Compute Engine, the built-in service account associated with the virtual machine instance will be used.
schmunk42 commented 5 years ago

@razvanphp Sorry, I do not understand the problem you are referring to.

We are using this since a while without any issues.

Can you describe more in detail or create a new issue if needed.

razvanphp commented 5 years ago

In here, if we specify keyFilePath, then automatic authentication from ENV for example or Google App Engine will not work anymore, because file is the first one in priority. I would suggest to create $this->config and pass this to the Client like this:

    protected function prepareAdapter()
    {
        if (isset($this->config['keyFilePath'])) {
            $this->config['keyFilePath'] = \Yii::getAlias($this->config['keyFilePath']);
        }

        $client = new StorageClient($this->config);
        $bucket = $client->bucket($this->bucket);
        return  new GoogleStorageAdapter($client, $bucket);
    }
schmunk42 commented 5 years ago

How do handle projectId?

razvanphp commented 5 years ago

In Google App Engine it is also not required, it's automatically injected from the ENV.

schmunk42 commented 5 years ago

Can you create a PR, which is backward-compatible?