good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
chat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
github
tinode
chat
Commits
e67c1062
Commit
e67c1062
authored
Jun 23, 2021
by
aforge
Browse files
Options
Downloads
Patches
Plain Diff
Allow overriding status path with configs and cmd line.
parent
55e80309
Branches
fixes
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
server/http.go
+0
-1
0 additions, 1 deletion
server/http.go
server/main.go
+12
-1
12 additions, 1 deletion
server/main.go
server/tinode.conf
+4
-0
4 additions, 0 deletions
server/tinode.conf
with
16 additions
and
2 deletions
server/http.go
+
0
−
1
View file @
e67c1062
...
...
@@ -384,7 +384,6 @@ func serveStatus(wrt http.ResponseWriter, req *http.Request) {
now
:=
time
.
Now
()
fmt
.
Fprintf
(
wrt
,
"<body>"
)
fmt
.
Fprintf
(
wrt
,
"<h1>%s</h1><div>Version: %s, build: %s. Present time: %s</div>"
,
"Tinode Server"
,
currentVersion
,
buildstamp
,
now
.
Format
(
time
.
RFC1123
))
fmt
.
Fprintf
(
wrt
,
"<a href='/status'>Update</a>"
)
fmt
.
Fprintf
(
wrt
,
"<br><hr>"
)
fmt
.
Fprintf
(
wrt
,
"<div>Sessions: %d</div>"
,
len
(
globals
.
sessionStore
.
sessCache
))
...
...
This diff is collapsed.
Click to expand it.
server/main.go
+
12
−
1
View file @
e67c1062
...
...
@@ -233,6 +233,8 @@ type configType struct {
MaxTagCount
int
`json:"max_tag_count"`
// URL path for exposing runtime stats. Disabled if the path is blank.
ExpvarPath
string
`json:"expvar"`
// URL path for internal server status. Disabled if the path is blank.
ServerStatusPath
string
`json:"server_status"`
// Take IP address of the client from HTTP header 'X-Forwarded-For'.
// Useful when tinode is behind a proxy. If missing, fallback to default RemoteAddr.
UseXForwardedFor
bool
`json:"use_x_forwarded_for"`
...
...
@@ -266,6 +268,7 @@ func main() {
tlsEnabled
:=
flag
.
Bool
(
"tls_enabled"
,
false
,
"Override config value for enabling TLS."
)
clusterSelf
:=
flag
.
String
(
"cluster_self"
,
""
,
"Override the name of the current cluster node."
)
expvarPath
:=
flag
.
String
(
"expvar"
,
""
,
"Override the URL path where runtime stats are exposed. Use '-' to disable."
)
serverStatusPath
:=
flag
.
String
(
"server_status"
,
""
,
"Override the URL path where the server's internal status is displayed. Use '-' to disable."
)
pprofFile
:=
flag
.
String
(
"pprof"
,
""
,
"File name to save profiling info to. Disabled if not set."
)
pprofUrl
:=
flag
.
String
(
"pprof_url"
,
""
,
"Debugging only! URL path for exposing profiling info. Disabled if not set."
)
flag
.
Parse
()
...
...
@@ -616,7 +619,15 @@ func main() {
}
}
logs
.
Info
.
Printf
(
"API served from root URL path '%s'"
,
config
.
ApiPath
)
mux
.
HandleFunc
(
"/status"
,
serveStatus
)
sspath
:=
*
serverStatusPath
if
sspath
==
""
||
sspath
==
"-"
{
sspath
=
config
.
ServerStatusPath
}
if
sspath
!=
""
&&
sspath
!=
"-"
{
logs
.
Info
.
Printf
(
"Server status is available at '%s'"
,
sspath
)
mux
.
HandleFunc
(
sspath
,
serveStatus
)
}
// Handle websocket clients.
mux
.
HandleFunc
(
config
.
ApiPath
+
"v0/channels"
,
serveWebSocket
)
...
...
This diff is collapsed.
Click to expand it.
server/tinode.conf
+
4
−
0
View file @
e67c1062
...
...
@@ -46,6 +46,10 @@
//
Could
be
overriden
from
the
command
line
with
--
expvar
.
"expvar"
:
"/debug/vars"
,
//
URL
path
for
internal
server
status
.
Disabled
if
the
path
is
blank
or
"-"
.
//
Could
be
overriden
from
the
command
line
with
--
server_status
.
"server_status"
:
"/status"
,
//
Read
IP
address
of
the
client
from
the
HTTP
header
'X-Forwarded-For'
.
//
Useful
when
Tinode
is
behind
a
proxy
.
If
missing
,
fallback
to
default
RemoteAddr
.
"use_x_forwarded_for"
:
true
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment