-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Anycable * fix: selenium * fix: CI * fix: CI * fix: README
- Loading branch information
Showing
12 changed files
with
152 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module Turbo | ||
module Train | ||
class AnycableServer < BaseServer | ||
def publish(topics:, data:) | ||
uri = URI(server_config.publish_url) | ||
req = Net::HTTP::Post.new(uri) | ||
req['Content-Type'] = 'application/json' | ||
req['Authorization'] = "Bearer #{server_config.broadcast_key}" | ||
|
||
message = data[:data].gsub("\n", '') | ||
|
||
opts = { | ||
use_ssl: uri.scheme == 'https' | ||
} | ||
|
||
payload = [] | ||
|
||
Array(topics).each do |topic| | ||
payload << { stream: topic, data: message } | ||
end | ||
|
||
req.body = payload.to_json | ||
|
||
opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE if configuration.skip_ssl_verification | ||
|
||
Net::HTTP.start(uri.host, uri.port, opts) do |http| | ||
http.request(req) | ||
end | ||
end | ||
|
||
def server_config | ||
configuration.anycable | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Turbo | ||
module Train | ||
VERSION = "0.3.0" | ||
VERSION = "0.4.0" | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
Turbo::Train.configure do |config| | ||
config.default_server = ENV.fetch('TURBO_TRAIN_TEST_SERVER', 'mercure').to_sym | ||
|
||
config.server :mercure do |mercure| | ||
mercure.mercure_domain = ENV['MERCURE_DOMAIN'] || raise('MERCURE_DOMAIN is not set') | ||
mercure.publisher_key = ENV['MERCURE_PUBLISHER_KEY'] || raise('MERCURE_PUBLISHER_KEY is not set') | ||
mercure.subscriber_key = ENV['MERCURE_SUBSCRIBER_KEY'] || raise('MERCURE_SUBSCRIBER_KEY is not set') | ||
if ENV.fetch('TURBO_TRAIN_TEST_SERVER', 'mercure').to_sym == :mercure | ||
config.server :mercure do |mercure| | ||
mercure.mercure_domain = ENV['MERCURE_DOMAIN'] || raise('MERCURE_DOMAIN is not set') | ||
mercure.publisher_key = ENV['MERCURE_PUBLISHER_KEY'] || raise('MERCURE_PUBLISHER_KEY is not set') | ||
mercure.subscriber_key = ENV['MERCURE_SUBSCRIBER_KEY'] || raise('MERCURE_SUBSCRIBER_KEY is not set') | ||
end | ||
end | ||
|
||
config.server :fanout do |fanout| | ||
fanout.service_url = ENV['FANOUT_SERVICE_URL'] || raise('FANOUT_SERVICE_URL is not set') | ||
fanout.service_id = ENV['FANOUT_SERVICE_ID'] || raise('FANOUT_SERVICE_ID is not set') | ||
fanout.fastly_key = ENV['FANOUT_FASTLY_KEY'] || raise('FANOUT_FASTLY_KEY is not set') | ||
if ENV.fetch('TURBO_TRAIN_TEST_SERVER', 'mercure').to_sym == :fanout | ||
config.server :fanout do |fanout| | ||
fanout.service_url = ENV['FANOUT_SERVICE_URL'] || raise('FANOUT_SERVICE_URL is not set') | ||
fanout.service_id = ENV['FANOUT_SERVICE_ID'] || raise('FANOUT_SERVICE_ID is not set') | ||
fanout.fastly_key = ENV['FANOUT_FASTLY_KEY'] || raise('FANOUT_FASTLY_KEY is not set') | ||
end | ||
end | ||
end | ||
|
||
if ENV.fetch('TURBO_TRAIN_TEST_SERVER', 'mercure').to_sym == :anycable | ||
config.server :anycable do |anycable| | ||
anycable.anycable_url = ENV['ANYCABLE_URL'] || raise('ANYCABLE_URL is not set') | ||
anycable.broadcast_key = ENV['ANYCABLE_BROADCAST_KEY'] || raise('ANYCABLE_BROADCAST_KEY is not set') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters