Skip to content

Commit

Permalink
doc: proxy feature is experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
miyataka committed Dec 27, 2023
1 parent 670c33e commit 89619de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Fcmpush.configure do |config|
config.server_key = 'your firebase server key'
# Or set environment variables
# ENV['FCM_SERVER_KEY'] = 'your firebase server key'

# Proxy ENV variables are considered by default if set by net/http, but you can explicitly define your proxy host here
# user and password are optional
# config.proxy = { uri: "http://proxy.host:3128", user: nil, password: nil }
Expand Down Expand Up @@ -152,6 +152,10 @@ Comparison:
firebase_cloud_messenger: 3.2 i/s - 5.94x (± 0.00) slower
```

## Experimental Features
- proxy
- LIMITATION: support `http_proxy` only. NOT supports `HTTPS_PROXY`.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/miyataka/fcmpush.
Expand Down
1 change: 1 addition & 0 deletions lib/fcmpush/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def initialize(domain, project_id, configuration, **options)
@access_token_expiry = Time.now.utc + access_token_response['expires_in']
@server_key = configuration.server_key
@connection = Net::HTTP::Persistent.new

if configuration.proxy && configuration.proxy[:uri]
uri = URI(configuration.proxy[:uri])
# user name must not be a empty string, password can
Expand Down
6 changes: 6 additions & 0 deletions lib/fcmpush/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ def initialize

# regacy auth
@server_key = ENV['FCM_SERVER_KEY']

# THIS IS EXPERIMENTAL
# NOT support `HTTPS_PROXY` environment variable. This feature not tested well on CI.
# cf. https://github.com/miyataka/fcmpush/pull/39#issuecomment-1722533622
# proxy
@proxy = :ENV
end
end
end

0 comments on commit 89619de

Please sign in to comment.