Fixing #521 - Documenting the server role (#535)

This commit is contained in:
James Hodgkinson 2021-07-24 15:00:08 +10:00 committed by GitHub
parent ea080feac8
commit a621cbc6a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 8 deletions

View file

@ -42,16 +42,16 @@ You will also need a config file in the volume named `server.toml` (Within the c
#
# The role of this server. This affects features available and how replication may interact.
# Valid roles are:
# - write_replica
# - WriteReplica
# This server provides all functionality of Kanidm. It allows authentication, writes, and
# the web user interface to be served.
# - write_replica_no_ui
# This server is the same as a write_replica, but does NOT offer the web user interface.
# - read_only_replica
# - WriteReplicaNoUI
# This server is the same as a WriteReplica, but does NOT offer the web user interface.
# - ReadOnlyReplica
# This server will not writes initiated by clients. It supports authentication and reads,
# and must have a replication agreement as a source of it's data.
# Defaults to "write_replica".
# role = "write_replica"
# Defaults to "WriteReplica".
# role = "WriteReplica"
An example is located in [examples/server.toml](../../examples/server.toml).

View file

@ -1,5 +1,5 @@
FROM opensuse/leap:latest
MAINTAINER william@blackhats.net.au
LABEL org.opencontainers.image.authors="william@blackhats.net.au"
EXPOSE 1812 1813

View file

@ -33,6 +33,16 @@ impl Default for ServerRole {
}
}
impl ToString for ServerRole {
fn to_string(&self) -> String {
match self {
ServerRole::WriteReplica => "write replica".to_string(),
ServerRole::WriteReplicaNoUI => "write replica (no ui)".to_string(),
ServerRole::ReadOnlyReplica => "read only replica".to_string(),
}
}
}
impl FromStr for ServerRole {
type Err = &'static str;
@ -85,6 +95,7 @@ impl fmt::Display for Configuration {
Some(u) => write!(f, "with log_level: {:x}, ", u),
None => write!(f, "with log_level: default, "),
})
.and_then(|_| write!(f, "role: {}, ", self.role.to_string()))
.and_then(|_| {
write!(
f,