Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
conduwuit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
🥺
conduwuit
Commits
196c8393
Commit
196c8393
authored
3 years ago
by
Andrej Kacian
Browse files
Options
Downloads
Patches
Plain Diff
Add show-config admin room command
parent
237645e9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/config.rs
+92
-0
92 additions, 0 deletions
src/config.rs
src/database/admin.rs
+7
-0
7 additions, 0 deletions
src/database/admin.rs
src/database/globals.rs
+1
-1
1 addition, 1 deletion
src/database/globals.rs
with
100 additions
and
1 deletion
src/config.rs
+
92
−
0
View file @
196c8393
use
std
::{
use
std
::{
collections
::
BTreeMap
,
collections
::
BTreeMap
,
fmt
,
net
::{
IpAddr
,
Ipv4Addr
},
net
::{
IpAddr
,
Ipv4Addr
},
};
};
...
@@ -97,6 +98,97 @@ pub fn warn_deprecated(&self) {
...
@@ -97,6 +98,97 @@ pub fn warn_deprecated(&self) {
}
}
}
}
impl
fmt
::
Display
for
Config
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
<
'_
>
)
->
fmt
::
Result
{
// Prepare a list of config values to show
let
lines
=
[
(
"Server name"
,
self
.server_name
.host
()),
(
"Database backend"
,
&
self
.database_backend
),
(
"Database path"
,
&
self
.database_path
),
(
"Database cache capacity (MB)"
,
&
self
.db_cache_capacity_mb
.to_string
(),
),
(
"Cache capacity modifier"
,
&
self
.conduit_cache_capacity_modifier
.to_string
(),
),
#[cfg(feature
=
"rocksdb"
)]
(
"Maximum open files for RocksDB"
,
&
self
.rocksdb_max_open_files
.to_string
(),
),
(
"PDU cache capacity"
,
&
self
.pdu_cache_capacity
.to_string
()),
(
"Cleanup interval in seconds"
,
&
self
.cleanup_second_interval
.to_string
(),
),
(
"Maximum request size"
,
&
self
.max_request_size
.to_string
()),
(
"Maximum concurrent requests"
,
&
self
.max_concurrent_requests
.to_string
(),
),
(
"Allow registration"
,
&
self
.allow_registration
.to_string
()),
(
"Allow encryption"
,
&
self
.allow_encryption
.to_string
()),
(
"Allow federation"
,
&
self
.allow_federation
.to_string
()),
(
"Allow room creation"
,
&
self
.allow_room_creation
.to_string
()),
(
"JWT secret"
,
match
self
.jwt_secret
{
Some
(
_
)
=>
"set"
,
None
=>
"not set"
,
},
),
(
"Trusted servers"
,
{
let
mut
lst
=
vec!
[];
for
server
in
&
self
.trusted_servers
{
lst
.push
(
server
.host
());
}
&
lst
.join
(
", "
)
}),
(
"TURN username"
,
if
self
.turn_username
.is_empty
()
{
"not set"
}
else
{
&
self
.turn_username
},
),
(
"TURN password"
,
{
if
self
.turn_password
.is_empty
()
{
"not set"
}
else
{
"set"
}
}),
(
"TURN secret"
,
{
if
self
.turn_secret
.is_empty
()
{
"not set"
}
else
{
"set"
}
}),
(
"Turn TTL"
,
&
self
.turn_ttl
.to_string
()),
(
"Turn URIs"
,
{
let
mut
lst
=
vec!
[];
for
item
in
self
.turn_uris
.to_vec
()
.into_iter
()
.enumerate
()
{
let
(
_
,
uri
):
(
usize
,
String
)
=
item
;
lst
.push
(
uri
);
}
&
lst
.join
(
", "
)
}),
];
let
mut
msg
:
String
=
"Active config values:
\n\n
"
.to_string
();
for
line
in
lines
.into_iter
()
.enumerate
()
{
msg
+=
&
format!
(
"{}: {}
\n
"
,
line
.1
.0
,
line
.1
.1
);
}
write!
(
f
,
"{}"
,
msg
)
}
}
fn
false_fn
()
->
bool
{
fn
false_fn
()
->
bool
{
false
false
}
}
...
...
This diff is collapsed.
Click to expand it.
src/database/admin.rs
+
7
−
0
View file @
196c8393
...
@@ -259,6 +259,9 @@ enum AdminCommand {
...
@@ -259,6 +259,9 @@ enum AdminCommand {
/// Print database memory usage statistics
/// Print database memory usage statistics
DatabaseMemoryUsage
,
DatabaseMemoryUsage
,
/// Show configuration values
ShowConfig
,
}
}
fn
process_admin_command
(
fn
process_admin_command
(
...
@@ -428,6 +431,10 @@ fn process_admin_command(
...
@@ -428,6 +431,10 @@ fn process_admin_command(
e
e
)),
)),
},
},
AdminCommand
::
ShowConfig
=>
{
// Construct and send the response
RoomMessageEventContent
::
text_plain
(
format!
(
"{}"
,
db
.globals.config
))
}
};
};
Ok
(
reply_message_content
)
Ok
(
reply_message_content
)
...
...
This diff is collapsed.
Click to expand it.
src/database/globals.rs
+
1
−
1
View file @
196c8393
...
@@ -35,7 +35,7 @@ pub struct Globals {
...
@@ -35,7 +35,7 @@ pub struct Globals {
pub
actual_destination_cache
:
Arc
<
RwLock
<
WellKnownMap
>>
,
// actual_destination, host
pub
actual_destination_cache
:
Arc
<
RwLock
<
WellKnownMap
>>
,
// actual_destination, host
pub
tls_name_override
:
Arc
<
RwLock
<
TlsNameMap
>>
,
pub
tls_name_override
:
Arc
<
RwLock
<
TlsNameMap
>>
,
pub
(
super
)
globals
:
Arc
<
dyn
Tree
>
,
pub
(
super
)
globals
:
Arc
<
dyn
Tree
>
,
config
:
Config
,
pub
config
:
Config
,
keypair
:
Arc
<
ruma
::
signatures
::
Ed25519KeyPair
>
,
keypair
:
Arc
<
ruma
::
signatures
::
Ed25519KeyPair
>
,
dns_resolver
:
TokioAsyncResolver
,
dns_resolver
:
TokioAsyncResolver
,
jwt_decoding_key
:
Option
<
jsonwebtoken
::
DecodingKey
<
'static
>>
,
jwt_decoding_key
:
Option
<
jsonwebtoken
::
DecodingKey
<
'static
>>
,
...
...
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