Skip to content

Commit b0cb351

Browse files
committed
fix: allow localhosts in development
1 parent 757ce64 commit b0cb351

File tree

10 files changed

+66
-0
lines changed

10 files changed

+66
-0
lines changed

appengine/analytics/app.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
require "sinatra"
1717
require "net/http"
1818

19+
# [END gae_flex_analytics_track_event]
20+
# Allows all hosts in development
21+
configure :development do
22+
set :host_authorization, { permitted_hosts: [] }
23+
end
24+
25+
# [START gae_flex_analytics_track_event]
1926
# The following environment variable is set by app.yaml when running on GAE,
2027
# but will need to be manually set when running locally. See README.md.
2128
GA_TRACKING_ID = ENV["GA_TRACKING_ID"]

appengine/cloud-tasks/app.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
require "sinatra"
1919
require "json"
2020

21+
# [END cloud_tasks_appengine_quickstart]
22+
# Allows all hosts in development
23+
configure :development do
24+
set :host_authorization, { permitted_hosts: [] }
25+
end
26+
27+
# [START cloud_tasks_appengine_quickstart]
2128
get "/" do
2229
# Basic index to verify app is serving
2330
"Hello World!"

appengine/datastore/app.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
require "sinatra"
1818
require "google/cloud/datastore"
1919

20+
# [END gae_flex_datastore_app]
21+
# Allows all hosts in development
22+
configure :development do
23+
set :host_authorization, { permitted_hosts: [] }
24+
end
25+
26+
# [START gae_flex_datastore_app]
2027
get "/" do
2128
datastore = Google::Cloud::Datastore.new
2229

appengine/hello_world/app.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
# [START gae_flex_quickstart]
1616
require "sinatra"
1717

18+
# [END gae_flex_quickstart]
19+
# Allows all hosts in development
20+
configure :development do
21+
set :host_authorization, { permitted_hosts: [] }
22+
end
23+
24+
# [START gae_flex_quickstart]
1825
get "/" do
1926
"Hello world!"
2027
end

appengine/metadata_server/app.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
require "sinatra"
1717
require "net/http"
1818

19+
# [END gae_flex_metadata]
20+
# Allows all hosts in development
21+
configure :development do
22+
set :host_authorization, { permitted_hosts: [] }
23+
end
24+
25+
# [START gae_flex_metadata]
1926
get "/" do
2027
uri = URI.parse(
2128
"http://metadata.google.internal/computeMetadata/v1" +

appengine/pubsub/app.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121

2222
pubsub = Google::Cloud::Pubsub.new
2323

24+
# Allows all hosts in development
25+
configure :development do
26+
set :host_authorization, { permitted_hosts: [] }
27+
end
28+
2429
# [START gae_flex_pubsub_env]
2530
topic = pubsub.topic ENV["PUBSUB_TOPIC"]
2631
PUBSUB_VERIFICATION_TOKEN = ENV["PUBSUB_VERIFICATION_TOKEN"]

appengine/standard-metadata-server/app.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
require "sinatra"
1717
require "net/http"
1818

19+
# [END gae_standard_metadata]
20+
# Allows all hosts in development
21+
configure :development do
22+
set :host_authorization, { permitted_hosts: [] }
23+
end
24+
25+
# [START gae_standard_metadata]
1926
get "/" do
2027
uri = URI.parse(
2128
"http://metadata.google.internal/computeMetadata/v1" +

appengine/storage/app.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
require "sinatra"
1717
require "google/cloud/storage"
1818

19+
# [END gae_flex_storage_app]
20+
# Allows all hosts in development
21+
configure :development do
22+
set :host_authorization, { permitted_hosts: [] }
23+
end
24+
25+
# [START gae_flex_storage_app]
1926
storage = Google::Cloud::Storage.new
2027
bucket = storage.bucket ENV["GOOGLE_CLOUD_STORAGE_BUCKET"]
2128

appengine/twilio/app.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
require "sinatra"
1616
require "twilio-ruby"
1717

18+
# Allows all hosts in development
19+
configure :development do
20+
set :host_authorization, { permitted_hosts: [] }
21+
end
22+
1823
TWILIO_ACCOUNT_SID = ENV["TWILIO_ACCOUNT_SID"]
1924
TWILIO_AUTH_TOKEN = ENV["TWILIO_AUTH_TOKEN"]
2025
TWILIO_NUMBER = ENV["TWILIO_NUMBER"]

appengine/websockets/app.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121

2222
Faye::WebSocket.load_adapter "thin"
2323

24+
# [END gae_flex_websockets]
25+
# Allows all hosts in development
26+
configure :development do
27+
set :host_authorization, { permitted_hosts: [] }
28+
end
29+
30+
# [START gae_flex_websockets]
2431
# For the purposes of this example, use a global variable to keep track of
2532
# all connected clients in order to send chat messages. This approach limits
2633
# us to a single server and a single process; a more robust solution would be

0 commit comments

Comments
 (0)