Documentation ¶
Index ¶
- Variables
- func CleanDatabase()
- func GetDatabase() *sql.DB
- func GetHttpStatus(code int) string
- func InitHttpStatusCodeMap()
- func InitSessionManagement()
- func IsLoggedIn(r *http.Request) bool
- func LoginAndGetCookie(username string) http.Cookie
- func LogoutAndDestroyCookie(r *http.Request) http.Cookie
- func OpenDatabase(config databaseConfiguration)
- func ReadConfigurationFromDatabase(db *sql.DB)
- func ReadConfigurationFromFile(filePath string)
- func ReadDefaultConfiguration(filePath string)
- func RunTelegramBot()
- func SetStaticConfiguration(c StaticConfiguration)
- func SetupLogger()
- type Admin
- type Configuration
- type StaticConfiguration
- type Website
Constants ¶
This section is empty.
Variables ¶
var Bot *telebot.Bot
var SendOptions = telebot.SendOptions{DisableWebPagePreview: true, ParseMode: telebot.ModeMarkdown}
Functions ¶
func CleanDatabase ¶
func CleanDatabase()
Removes all check-results older than one month from the Database
func GetHttpStatus ¶
Returns a HTTP-status-code-string representing the given HTTP-status-code.
func IsLoggedIn ¶
Checks if the given Request contains a Cookie and if the Cookie authenticates a specific user.
func LoginAndGetCookie ¶
Logs the user in by returning a Cookie containing a randomId.
func LogoutAndDestroyCookie ¶
Logs the user out by returning a Cookie, which expired a day ago.
func OpenDatabase ¶
func OpenDatabase(config databaseConfiguration)
Opens a new connection-pool to the database using the given databaseConfiguration.
func ReadConfigurationFromDatabase ¶
Reads all configuration-data from the database.
func ReadConfigurationFromFile ¶
func ReadConfigurationFromFile(filePath string)
Reads a configuration-file from a specified path.
func ReadDefaultConfiguration ¶
func ReadDefaultConfiguration(filePath string)
Reads the default configuration-file from a specified path.
func RunTelegramBot ¶
func RunTelegramBot()
func SetStaticConfiguration ¶
func SetStaticConfiguration(c StaticConfiguration)
Allows to replace the current StaticConfiguration.
Types ¶
type Admin ¶
type Admin struct {
// contains filtered or unexported fields
}
Contains the current password hash.
func (*Admin) ChangePassword ¶
Changes the current password to the given one. Returns an error (if there was one).
func (*Admin) Init ¶
func (a *Admin) Init()
Init an Admin-struct. Creates an Admin user if there is none.
func (*Admin) LoadPassword ¶
Loads the current password hash into the Admin-struct. Returns true, if there was a password hash in the database or false, if not.
func (*Admin) ValidatePassword ¶
Validates the entered password. Returns true, if the password matched the stored hash and false, if not.
type Configuration ¶
type Configuration struct { Address string Port int Database databaseConfiguration Application applicationConfiguration Notification notificationConfiguration Dynamic dynamicConfiguration Static StaticConfiguration }
The whole configuration. Contains all other configuration-data.
func GetConfiguration ¶
func GetConfiguration() *Configuration
Returns the current Configuration-object.
type StaticConfiguration ¶
Static data about (e.g.) the application's version.