-
Notifications
You must be signed in to change notification settings - Fork 27
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
Support multiple buckets #32
Comments
As of now the first enabled GSC bucket is used for |
But I could convert disk root path from |
Any thoughts? |
I'm kind of torn between the simplicity of it all just being file paths, but the explicitness of using straight-up bucket names. Something I did in my build setup (which is not optimal) is run my That prompted this: https://code.google.com/p/googleappengine/issues/detail?id=12297 Based on all this though, I'm inclined to think that we should have somewhere in our applications an environment variable that defines which bucket we want to use. Which then gets picked up by configurations of the gae filesystem driver. Whether it's Hopefully what I said makes sense or has some valuable takeaways ;) |
Does this help? /**
* Override the storage path
*
* @return string Storage path URL
*/
public function storagePath()
{
if ($this->runningOnGae)
{
if ( ! is_null($this->gaeBucketPath))
{
return $this->gaeBucketPath;
}
$buckets = ini_get('google_app_engine.allow_include_gs_buckets');
// Get the defined bucket or the first bucket in the list.
$bucket = env('GAE_GCS_BUCKET', current(explode(', ', $buckets)));
if ($bucket)
{
$this->gaeBucketPath = "gs://{$bucket}/storage";
if (env('GAE_SKIP_GCS_INIT'))
{
return $this->gaeBucketPath;
}
if ( ! file_exists($this->gaeBucketPath))
{
mkdir($this->gaeBucketPath);
mkdir($this->gaeBucketPath.'/app');
mkdir($this->gaeBucketPath.'/framework');
mkdir($this->gaeBucketPath.'/framework/views');
}
return $this->gaeBucketPath;
}
}
return parent::storagePath();
} |
Looks perfect. |
I will have to rearrange some of the documentation and add the environment variable to BTW, what did you mean by |
Oh, sorry. I meant to follow up there, it's probably nothing. I just had seen some directories and files (services.json) being created in cloud storage that I thought were things going to cachefs. And it looks like they still are. |
Please notice that Regarding |
Does |
When Anyway, I'm open to suggestions. |
Actually, I can return an instance of class LazyString
{
protected $getString;
// Store a callback to storage path initialization function
public function __construct(callable $getString)
{
$this->getString = $getString;
}
// Initialize the storage path and return its string value
public function __toString()
{
return call_user_func($this->getString);
}
} It works, but is this bit of 'ease of use' worth the complexity of the solution? |
I guess the issue is that the bucket name is environment specific for me. I have staging and production buckets to ensure isolation. The only file I'd ideally like to touch during my build process is I have my request in with GAE to be able to select the default bucket for an app, which ought to cover 99% of the scenarios by setting it to |
Just trying to understand, you would like to touch only |
|
In this case is it correct to say: |
Currently, I'm using it for both. But it's possible that I might want to separate the two, or establish multiple buckets for my project. |
gitter? |
Sure thing. |
If I'm correct in reading the current code, it looks like the first bucket configured in php.ini is the one that this package uses.
Would it be worthwhile to allow the bucket used to be configured at a driver/L5 filesystem level?
The text was updated successfully, but these errors were encountered: