Closed schmunk42 closed 6 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.
@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.
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);
}
How do handle projectId
?
In Google App Engine it is also not required, it's automatically injected from the ENV.
Can you create a PR, which is backward-compatible?
Kindly asking to merge this feature into master. Exactly what I need right now.