Allow remote access to dev services
This commit is contained in:
3 files changed
+35
-5
No files matched your search
@@ -110,6 +110,19 @@ The S3 API is available at http://localhost:3900 (region `garage`). If you want
|
||||
to start over with a fresh storage, delete the `garage-data` volume as well as
|
||||
the container.
|
||||
|
||||
#### Accessing remoteStorage from another machine
|
||||
|
||||
remoteStorage clients force HTTPS for any host except `localhost`, and browsers
|
||||
block plain-HTTP requests to a LAN IP as mixed content. To connect to the dev
|
||||
remoteStorage from a browser on another machine (including production apps such
|
||||
as Inspektor), forward the ports over SSH and connect as `localhost`:
|
||||
|
||||
ssh -N -L 3000:localhost:3000 -L 4567:localhost:4567 <user>@<dev-host>
|
||||
|
||||
Then use `<user>@localhost:3000` as the remoteStorage address in the client.
|
||||
WeFinger discovery and storage requests are served through the forwarded ports,
|
||||
so no TLS setup is needed.
|
||||
|
||||
### Adding npm modules to use with Stimulus controllers
|
||||
|
||||
The following command downloads the specified npm module to `vendor/javascript`
|
||||
|
||||
@@ -22,9 +22,12 @@ class Services::RsAuthsController < Services::BaseController
|
||||
end
|
||||
|
||||
def launch_app
|
||||
user_address = Rails.env.development? ?
|
||||
"#{current_user.cn}@localhost:3000" :
|
||||
current_user.address
|
||||
user_address =
|
||||
if Rails.env.development?
|
||||
"#{current_user.cn}@#{request.host_with_port}"
|
||||
else
|
||||
current_user.address
|
||||
end
|
||||
|
||||
launch_url = "#{@auth.launch_url}#remotestorage=#{user_address}"
|
||||
|
||||
|
||||
@@ -88,8 +88,14 @@ class WebfingerController < WellKnownController
|
||||
end
|
||||
|
||||
def remotestorage_link
|
||||
auth_url = new_rs_oauth_url(@username, host: Setting.rs_accounts_domain)
|
||||
storage_url = "#{Setting.rs_storage_url}/#{@username}"
|
||||
auth_url =
|
||||
if Rails.env.development?
|
||||
new_rs_oauth_url(@username)
|
||||
else
|
||||
new_rs_oauth_url(@username, host: Setting.rs_accounts_domain)
|
||||
end
|
||||
|
||||
storage_url = "#{remotestorage_storage_base_url}/#{@username}"
|
||||
|
||||
{
|
||||
rel: "http://tools.ietf.org/id/draft-dejong-remotestorage",
|
||||
@@ -103,4 +109,12 @@ class WebfingerController < WellKnownController
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def remotestorage_storage_base_url
|
||||
return Setting.rs_storage_url unless Rails.env.development?
|
||||
|
||||
uri = URI.parse(Setting.rs_storage_url)
|
||||
uri.host = request.host
|
||||
uri.to_s
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user