FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
code-server/src/node/coder_cloud.ts at v3.11.1 · coder/code-server · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
coder
/
code-server
Public
Notifications
You must be signed in to change notification settings
Fork
6.8k
Star
79.1k
Code
Issues
143
Pull requests
7
Discussions
Actions
Projects
Security and quality
1
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
code-server
/
src
/
node
/
coder_cloud.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (34 loc) · 1.08 KB
Breadcrumbs
code-server
/
src
/
node
/
coder_cloud.ts
Copy path
File metadata and controls
41 lines (34 loc) · 1.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import
{
logger
}
from
"@coder/logger"
import
{
spawn
}
from
"child_process"
import
path
from
"path"
import
split2
from
"split2"
// https://github.com/cdr/coder-cloud
const
coderCloudAgent
=
path
.
resolve
(
__dirname
,
"../../lib/coder-cloud-agent"
)
function
runAgent
(
...
args
:
string
[
]
)
:
Promise
<
void
>
{
logger
.
debug
(
`running agent with
${
args
}
`
)
const
agent
=
spawn
(
coderCloudAgent
,
args
,
{
stdio
:
[
"inherit"
,
"inherit"
,
"pipe"
]
,
}
)
agent
.
stderr
.
pipe
(
split2
(
)
)
.
on
(
"data"
,
(
line
)
=>
{
line
=
line
.
replace
(
/
^
[
0
-
9
-
]
+
[
0
-
9
:
]
+
[
^
]
+
\t
/
,
""
)
logger
.
info
(
line
)
}
)
return
new
Promise
(
(
res
,
rej
)
=>
{
agent
.
on
(
"error"
,
rej
)
agent
.
on
(
"close"
,
(
code
)
=>
{
if
(
code
!==
0
)
{
rej
(
{
message
:
`--link agent exited with
${
code
}
`
,
}
)
return
}
res
(
)
}
)
}
)
}
export
function
coderCloudBind
(
csAddr
:
string
,
serverName
=
""
)
:
Promise
<
void
>
{
// addr needs to be in host:port format.
// So we trim the protocol.
csAddr
=
csAddr
.
replace
(
/
^
h
t
t
p
s
?
:
\/
\/
/
,
""
)
return
runAgent
(
"bind"
,
`--code-server-addr=
${
csAddr
}
`
,
serverName
)
}
Back
|
FazBrowse Home
|
New Git URL