Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
slapos
Commits
48d0b1d2
Commit
48d0b1d2
authored
Apr 26, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/theia: serve a public folder
like webrunner is doing
parent
73e4e19f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
11 deletions
+26
-11
software/theia/buildout.hash.cfg
software/theia/buildout.hash.cfg
+1
-1
software/theia/instance.cfg.in
software/theia/instance.cfg.in
+5
-1
software/theia/test/test.py
software/theia/test/test.py
+20
-9
No files found.
software/theia/buildout.hash.cfg
View file @
48d0b1d2
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
[instance]
[instance]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
83e638fca1762c197ec5847c2deec98f
md5sum =
202f809fd759e9a507db7c7d33caae48
[yarn.lock]
[yarn.lock]
filename = yarn.lock
filename = yarn.lock
...
...
software/theia/instance.cfg.in
View file @
48d0b1d2
...
@@ -50,8 +50,10 @@ template = inline:
...
@@ -50,8 +50,10 @@ template = inline:
tls {
tls {
alpn http/1.1
alpn http/1.1
}
}
root $${directory:frontend-static}
browse
proxy / $${theia-instance:base-url} {
proxy / $${theia-instance:base-url} {
# transparent
except public
}
}
proxy /services $${theia-instance:base-url} {
proxy /services $${theia-instance:base-url} {
websocket
websocket
...
@@ -190,3 +192,5 @@ pidfiles = $${:var}/run
...
@@ -190,3 +192,5 @@ pidfiles = $${:var}/run
services = $${:etc}/service
services = $${:etc}/service
project = $${:srv}/project
project = $${:srv}/project
slapos = $${:srv}/slapos
slapos = $${:srv}/slapos
frontend-static = $${:srv}/frontend-static
frontend-static-public = $${:frontend-static}/public
software/theia/test/test.py
View file @
48d0b1d2
...
@@ -31,7 +31,7 @@ import textwrap
...
@@ -31,7 +31,7 @@ import textwrap
import
logging
import
logging
import
tempfile
import
tempfile
import
time
import
time
from
six.moves.urllib.parse
import
urlparse
from
six.moves.urllib.parse
import
urlparse
,
urljoin
import
pexpect
import
pexpect
import
requests
import
requests
...
@@ -54,16 +54,27 @@ class TestTheia(SlapOSInstanceTestCase):
...
@@ -54,16 +54,27 @@ class TestTheia(SlapOSInstanceTestCase):
# with login/password, this is allowed
# with login/password, this is allowed
parsed_url
=
urlparse
(
self
.
connection_parameters
[
'url'
])
parsed_url
=
urlparse
(
self
.
connection_parameters
[
'url'
])
resp
=
requests
.
get
(
authenticated_url
=
parsed_url
.
_replace
(
parsed_url
.
_replace
(
netloc
=
'{}:{}@[{}]:{}'
.
format
(
netloc
=
'{}:{}@[{}]:{}'
.
format
(
self
.
connection_parameters
[
'username'
],
self
.
connection_parameters
[
'username
'
],
self
.
connection_parameters
[
'password
'
],
self
.
connection_parameters
[
'password'
]
,
parsed_url
.
hostname
,
parsed_url
.
hostname
,
parsed_url
.
port
,
parsed_url
.
port
)).
geturl
(),
)).
geturl
()
verify
=
False
)
resp
=
requests
.
get
(
authenticated_url
,
verify
=
False
)
self
.
assertEqual
(
requests
.
codes
.
ok
,
resp
.
status_code
)
self
.
assertEqual
(
requests
.
codes
.
ok
,
resp
.
status_code
)
# there's a public folder to serve file
with
open
(
'{}/srv/frontend-static/public/test_file'
.
format
(
self
.
computer_partition_root_path
),
'w'
)
as
f
:
f
.
write
(
"hello"
)
resp
=
requests
.
get
(
urljoin
(
authenticated_url
,
'/public/'
),
verify
=
False
)
self
.
assertIn
(
'test_file'
,
resp
.
text
)
resp
=
requests
.
get
(
urljoin
(
authenticated_url
,
'/public/test_file'
),
verify
=
False
)
self
.
assertEqual
(
'hello'
,
resp
.
text
)
def
test_theia_slapos
(
self
):
def
test_theia_slapos
(
self
):
# Make sure we can use the shell and the integrated slapos command
# Make sure we can use the shell and the integrated slapos command
process
=
pexpect
.
spawnu
(
process
=
pexpect
.
spawnu
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment