Skip to content

Commit

Permalink
docstrings for crypto, database and email
Browse files Browse the repository at this point in the history
  • Loading branch information
Azrenbeth authored and Azrenbeth committed Sep 3, 2021
1 parent 7b5fad5 commit e311cff
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
9 changes: 9 additions & 0 deletions sydent/config/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@

class CryptoConfig(BaseConfig):
def parse_config(self, cfg: ConfigParser):
"""
Parse the crypto section of the config
Args:
cfg (ConfigParser): the configuration to be parsed
"""

signing_key_str = cfg.get("crypto", "ed25519.signingkey")
signing_key_parts = signing_key_str.split(" ")

Expand Down Expand Up @@ -48,4 +55,6 @@ def parse_config(self, cfg: ConfigParser):
signedjson.key.encode_signing_key_base64(self.signing_key),
)
cfg.set("crypto", "ed25519.signingkey", signing_key_str)

# This will trigger the updated cfg to be saved to file
self.update_cfg = True
6 changes: 6 additions & 0 deletions sydent/config/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@

class DatabaseConfig(BaseConfig):
def parse_config(self, cfg: ConfigParser):
"""
Parse the database section of the config
Args:
cfg (ConfigParser): the configuration to be parsed
"""
self.database_path = cfg.get("db", "db.file")
7 changes: 6 additions & 1 deletion sydent/config/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

class EmailConfig(BaseConfig):
def parse_config(self, cfg: ConfigParser):
"""
Parse the email section of the config
Args:
cfg (ConfigParser): the configuration to be parsed
"""

self.template = None
if cfg.has_option("email", "email.template"):
Expand All @@ -21,7 +27,6 @@ def parse_config(self, cfg: ConfigParser):
if self.host_name == "":
self.host_name = socket.getfqdn()

# These are deprecated options as subject is now set by templates
self.validation_subject = cfg.get("email", "email.subject")
self.invite_subject = cfg.get("email", "email.invite.subject", raw=True)
self.invite_subject_space = cfg.get(
Expand Down

0 comments on commit e311cff

Please sign in to comment.