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

@ -44,4 +44,4 @@ jobs:
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs publish_dir: ./docs
destination_dir: ./docs destination_dir: ./docs

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. # The role of this server. This affects features available and how replication may interact.
# Valid roles are: # Valid roles are:
# - write_replica # - WriteReplica
# This server provides all functionality of Kanidm. It allows authentication, writes, and # This server provides all functionality of Kanidm. It allows authentication, writes, and
# the web user interface to be served. # the web user interface to be served.
# - write_replica_no_ui # - WriteReplicaNoUI
# This server is the same as a write_replica, but does NOT offer the web user interface. # This server is the same as a WriteReplica, but does NOT offer the web user interface.
# - read_only_replica # - ReadOnlyReplica
# This server will not writes initiated by clients. It supports authentication and reads, # 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. # and must have a replication agreement as a source of it's data.
# Defaults to "write_replica". # Defaults to "WriteReplica".
# role = "write_replica" # role = "WriteReplica"
An example is located in [examples/server.toml](../../examples/server.toml). An example is located in [examples/server.toml](../../examples/server.toml).

View file

@ -1,5 +1,5 @@
FROM opensuse/leap:latest FROM opensuse/leap:latest
MAINTAINER william@blackhats.net.au LABEL org.opencontainers.image.authors="william@blackhats.net.au"
EXPOSE 1812 1813 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 { impl FromStr for ServerRole {
type Err = &'static str; type Err = &'static str;
@ -85,6 +95,7 @@ impl fmt::Display for Configuration {
Some(u) => write!(f, "with log_level: {:x}, ", u), Some(u) => write!(f, "with log_level: {:x}, ", u),
None => write!(f, "with log_level: default, "), None => write!(f, "with log_level: default, "),
}) })
.and_then(|_| write!(f, "role: {}, ", self.role.to_string()))
.and_then(|_| { .and_then(|_| {
write!( write!(
f, f,