Skip to content
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

Allow users to provide their own storage client #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

emilong
Copy link

@emilong emilong commented Nov 7, 2023

I had a few other bits of configuration I wanted to do on my Google::Cloud::Storage client instance beyond project and credentials, so I thought I'd just allow passing that in rather than adding more options.

Happy to discuss other alternatives though!

@4ndypanda
Copy link

+1 to supporting more options to pass to Google::Cloud::Storage. In our repo, we created a subclass of Shrine::Storage::GoogleCloudStorage and overrode the method #storage to be able to pass it more configs

  # @override
  def storage
    return @storage if @storage

    opts = {}
    opts[:project] = @project if @project
    opts[:credentials] = @credentials if @credentials
    # @storage_options initialized in our constructor
    opts.merge!(@storage_options)

    @storage = Google::Cloud::Storage.new(**opts)
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants