我一直在使用ruby sdk连接 FirebaseStorage ,它的工作一切正常,但我需要知道我如何可以增加该链接的到期日,它只给1或2分钟的到期日。我用水桶连接
FirebaseStorage
project_id = "wearabe6a" key_file = "service-account.json" storage = Google::Cloud::Storage.new project: project_id, keyfile: key_file bucket = storage.bucket "wearableeo.appspot.com" file = bucket.file file_name
然后我得到签名的url。哪一个可以工作几分钟,但我们如何才能增加该链接的到期日?
file.signed_url
更新:
我一直在用这个宝石做云存储 https://github.com/GoogleCloudPlatform/ruby-docs-samples/blob/master/storage/files.rb
您可以在 gem documentation for signed urls .
延长过期时间超过5分钟(默认值)使用:
require "google/cloud/storage" storage = Google::Cloud::Storage.new bucket = storage.bucket "my-todo-app" file = bucket.file "avatars/heidi/400x400.png" # Expire in five hours. # 18000 is five hours in seconds. shared_url = file.signed_url expires: 18000