Verbessere Dokumentation

This commit is contained in:
Gonne 2022-11-04 21:15:38 +01:00
parent ec24c6c4dc
commit fe54d76ab2
14 changed files with 75 additions and 34 deletions

View file

@ -1,3 +1,7 @@
// Package config implements the officeHours configuration
//
// It provides a struct type holding all necessary information for the programm.
// The configuration can be read from a JSON file.
package config
import (
@ -8,32 +12,34 @@ import (
"log"
)
// A Config holds all the constants for the programm.
// It is passed to most repositories.
type Config struct {
Server struct {
ListenAddress string
ListenPort int
Protocol string
Domain string
ListenAddress string // Address on which the http server is supposed to listen
ListenPort int // Port on which the http server is supposed to listen
Protocol string // Protocol to access the server; either "http" or "https"
Domain string // A string indicating the tool's base domain and path, e.g. "example.com/subfolder"
}
Date struct {
MinuteGranularity int
MinuteGranularity int // Restricts the minutes on which office hours can start and end to multiples of it.
}
Request struct {
SecretLength int
SecretLength int // Length of the secret token for requests
}
Mailer struct {
Type string
FromAddress string
FromName template.HTML
SmtpHost string
SmtpPort int
SmtpUseAuth bool
SmtpIdentity string
SmtpPassword string
Type string // Send mail to "Stdout" or "Smtp"
FromAddress string // Send mail from this address
FromName template.HTML // Send mail from this name, e.g. "Office hours <officeHours@localhost>"
SmtpHost string // Host to use as smarthost
SmtpPort int // Port of the smarthost
SmtpUseAuth bool // Set whether to use authentication on the smarthosthost
SmtpIdentity string // Smarthost username
SmtpPassword string // Smarthost password
}
SQL struct {
Type string
SQLiteFile string
Type string // Can be "SQLite" or "Mysql"
SQLiteFile string // Path to SQLite file
MysqlUser string
MysqlPassword string
MysqlHost string
@ -41,7 +47,8 @@ type Config struct {
MysqlDatabase string
}
Tutor struct {
MailSuffix string
MailSuffix string // Restrict mailaddresses of tutors to suffixes.
// e.g. "example.com" allowes "foo@example.com", "foo@sub.example.com", but not "foo@another.org" or "foo@barexample.com".
}
}
@ -92,5 +99,4 @@ func validateConfig(conf *Config) error {
log.Println(err.Error())
}
return err
}