aboutsummaryrefslogtreecommitdiff
path: root/api/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/api.go')
-rw-r--r--api/api.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/api/api.go b/api/api.go
index 79a13a5..e011811 100644
--- a/api/api.go
+++ b/api/api.go
@@ -8,8 +8,18 @@ import (
8) 8)
9 9
10var CONFIG Config 10var CONFIG Config
11var MAIL_CONFIG MailConfig
12
13type MailConfig struct {
14 IsEnabled bool
15 SmtpAddress string `toml:"smtp_address"`
16 AddressFrom string `toml:"address_from"`
17 Login string `toml:"login"`
18 Password string `toml:"password"`
19}
11 20
12type Config struct { 21type Config struct {
22 Domain string `toml:"domain"`
13 JwtSecret string `toml:"jwt_secret"` 23 JwtSecret string `toml:"jwt_secret"`
14 PasswordResetSecret string `toml:"password_reset_secret"` 24 PasswordResetSecret string `toml:"password_reset_secret"`
15 FreeSMSUser string `toml:"free_sms_user"` 25 FreeSMSUser string `toml:"free_sms_user"`
@@ -23,6 +33,15 @@ func SetConfig(config Config) {
23 PASSWORD_RESET_SECRET = []byte(config.PasswordResetSecret) 33 PASSWORD_RESET_SECRET = []byte(config.PasswordResetSecret)
24} 34}
25 35
36func SetMailConfig(config MailConfig) {
37 MAIL_CONFIG = config
38
39 if config.Login != "" && config.AddressFrom != "" && config.Password != "" && config.SmtpAddress != "" {
40 MAIL_CONFIG.IsEnabled = true
41 ConfigureMailTemplateEngine()
42 }
43}
44
26type Error struct { 45type Error struct {
27 Code ErrorCode 46 Code ErrorCode
28 UserMessage string 47 UserMessage string