diff --git a/config.go b/config.go index 842abea..a560bc3 100644 --- a/config.go +++ b/config.go @@ -25,16 +25,17 @@ type MailConfig struct { } type Config struct { - Ldap *LdapConfig - Mail *MailConfig - Secret string - TplPath string - Tls bool - Key string - Cert string - Port string - MaxID int - lock sync.Mutex + Ldap *LdapConfig + Mail *MailConfig + Secret string + TplPath string + UserTplPath string + Tls bool + Key string + Cert string + Port string + MaxID int + lock sync.Mutex } func validateConfigEntry(entry string, name string) bool { @@ -74,6 +75,7 @@ func LoadConfig() (*Config, error) { c.Key = viper.GetString("tls_key") c.Cert = viper.GetString("tls_cert") c.TplPath = viper.GetString("templates_path") + c.UserTplPath = viper.GetString("user_templates_path") m.SmtpServer = viper.GetString("SmtpServer") m.Username = viper.GetString("SmtpUsername") m.Password = viper.GetString("SmtpPassword") diff --git a/main.go b/main.go index 9a70ebd..9b98c21 100644 --- a/main.go +++ b/main.go @@ -41,6 +41,10 @@ func main() { router.HandleFunc("/reset/error", resetErrorPage).Methods("GET") log.Printf("Registering templates from %v/\n", Conf.TplPath) tpl = template.Must(template.ParseGlob(Conf.TplPath + "/*")) + if Conf.UserTplPath != "" { + log.Printf("Registering user templates from %v/\n", Conf.UsrTplPath) + tpl = template.Must(tpl.ParseGlob(Conf.UserTplPath + "/*")) + } log.Println("Performing LDAP checks") log.Println("Loading max employeeNumber for account creation") i, err := findLDAPMaxID()