Skip to content

Commit

Permalink
Merge pull request #28 from pepov/inline-credentials
Browse files Browse the repository at this point in the history
feat: inline credentials support
  • Loading branch information
daichirata authored Feb 3, 2024
2 parents d3b17cb + 4dc8a94 commit 5ce750a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/fluent/plugin/out_gcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def initialize
desc: "Project identifier for GCS"
config_param :keyfile, :string, default: nil,
desc: "Path of GCS service account credentials JSON file"
config_param :credentials_json, :hash, default: nil, secret: true,
desc: "GCS service account credentials in JSON format"
config_param :client_retries, :integer, default: nil,
desc: "Number of times to retry requests on server error"
config_param :client_timeout, :integer, default: nil,
Expand Down Expand Up @@ -94,12 +96,18 @@ def configure(conf)
# TODO: Remove time_slice_format when end of support compat_parameters
@configured_time_slice_format = conf['time_slice_format']
@time_slice_with_tz = Fluent::Timezone.formatter(@timekey_zone, @configured_time_slice_format || timekey_to_timeformat(@buffer_config['timekey']))

if @credentials_json
@credentials = @credentials_json
else
@credentials = keyfile
end
end

def start
@gcs = Google::Cloud::Storage.new(
project: @project,
keyfile: @keyfile,
keyfile: @credentials,
retries: @client_retries,
timeout: @client_timeout
)
Expand Down

0 comments on commit 5ce750a

Please sign in to comment.