Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos-mynij-dev
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
Mynij
slapos-mynij-dev
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 @@
[instance]
filename = instance.cfg.in
md5sum =
83e638fca1762c197ec5847c2deec98f
md5sum =
202f809fd759e9a507db7c7d33caae48
[yarn.lock]
filename = yarn.lock
...
...
software/theia/instance.cfg.in
View file @
48d0b1d2
...
...
@@ -50,8 +50,10 @@ template = inline:
tls {
alpn http/1.1
}
root $${directory:frontend-static}
browse
proxy / $${theia-instance:base-url} {
# transparent
except public
}
proxy /services $${theia-instance:base-url} {
websocket
...
...
@@ -190,3 +192,5 @@ pidfiles = $${:var}/run
services = $${:etc}/service
project = $${:srv}/project
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
import
logging
import
tempfile
import
time
from
six.moves.urllib.parse
import
urlparse
from
six.moves.urllib.parse
import
urlparse
,
urljoin
import
pexpect
import
requests
...
...
@@ -54,16 +54,27 @@ class TestTheia(SlapOSInstanceTestCase):
# with login/password, this is allowed
parsed_url
=
urlparse
(
self
.
connection_parameters
[
'url'
])
resp
=
requests
.
get
(
parsed_url
.
_replace
(
netloc
=
'{}:{}@[{}]:{}'
.
format
(
self
.
connection_parameters
[
'username
'
],
self
.
connection_parameters
[
'password'
]
,
parsed_url
.
hostname
,
parsed_url
.
port
)).
geturl
(),
verify
=
False
)
authenticated_url
=
parsed_url
.
_replace
(
netloc
=
'{}:{}@[{}]:{}'
.
format
(
self
.
connection_parameters
[
'username'
],
self
.
connection_parameters
[
'password
'
],
parsed_url
.
hostname
,
parsed_url
.
port
,
)).
geturl
()
resp
=
requests
.
get
(
authenticated_url
,
verify
=
False
)
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
):
# Make sure we can use the shell and the integrated slapos command
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