1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-11-02 00:23:01 +00:00

Add fields related to registration to the config

This commit is contained in:
bouncepaw
2021-04-12 19:26:49 +05:00
parent 15a0b62e1c
commit 9eff38fdc4
5 changed files with 29 additions and 15 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/go-ini/ini"
)
// See https://mycorrhiza.lesarbr.es/hypha/configuration/fields
type Config struct {
WikiName string
NaviTitleIcon string
@@ -30,6 +31,10 @@ type Network struct {
type Authorization struct {
UseFixedAuth bool
FixedAuthCredentialsPath string
UseRegistration bool
RegistrationCredentialsPath string
LimitRegistration uint64
}
func ReadConfigFile(path string) {
@@ -49,6 +54,10 @@ func ReadConfigFile(path string) {
Authorization: Authorization{
UseFixedAuth: false,
FixedAuthCredentialsPath: "",
UseRegistration: false,
RegistrationCredentialsPath: "",
LimitRegistration: 0,
},
}
@@ -60,6 +69,7 @@ func ReadConfigFile(path string) {
}
}
// Map the struct to the global variables
SiteName = cfg.WikiName
SiteNavIcon = cfg.NaviTitleIcon
HomePage = cfg.HomeHypha
@@ -70,4 +80,7 @@ func ReadConfigFile(path string) {
GeminiCertPath = cfg.GeminiCertificatePath
UseFixedAuth = cfg.UseFixedAuth
FixedCredentialsPath = cfg.FixedAuthCredentialsPath
UseRegistration = cfg.UseRegistration
RegistrationCredentialsPath = cfg.RegistrationCredentialsPath
LimitRegistration = cfg.LimitRegistration
}

View File

@@ -22,11 +22,14 @@ var (
URL string
GeminiCertPath string
UseFixedAuth bool
FixedCredentialsPath string
WikiDir string
ConfigFilePath string
UseFixedAuth bool
FixedCredentialsPath string
UseRegistration bool
RegistrationCredentialsPath string
LimitRegistration uint64
)
// LettersNumbersOnly keeps letters and numbers only in the given string.