💾 Archived View for gemini.rmf-dev.com › repo › Vaati › Gemigit › files › 4644aa7c7d80b2bdf0a5cb595e… captured on 2023-04-19 at 23:32:54. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
0 package config
1
2 import "github.com/kkyr/fig"
3
4 var Cfg Config
5
6 type Config struct {
7 Title string `validate:"required"`
8 Database struct {
9 Type string `validate:"required"`
10 Url string `validate:"required"`
11 }
12 Gemini struct {
13 Certificate string `validate:"required"`
14 Key string `validate:"required"`
15 Address string `validate:"required"`
16 Port string `validate:"required"`
17 Templates string `validate:"required"`
18 }
19 Git struct {
20 Https bool
21 Domain string `validate:"required"`
22 Remote struct {
23 Enabled bool
24 Url string
25 Address string
26 Key string
27 }
28 Address string `validate:"required"`
29 Port int `validate:"required"`
30 Key string
31 Public bool
32 }
33 Ldap struct {
34 Enabled bool
35 Url string
36 Attribute string
37 Binding string
38 }
39 Users struct {
40 Registration bool
41 }
42 Protection struct {
43 Ip int `validate:"required"`
44 Account int `validate:"required"`
45 Registration int `validate:"required"`
46 Reset int `validate:"required"`
47 }
48 }
49
50 func LoadConfig() error {
51 err := fig.Load(
52 &Cfg,
53 fig.File("config.yaml"),
54 fig.Dirs(".", "/etc/gemigit", "/usr/local/etc/gemigit"),
55 )
56 if err == nil && Cfg.Ldap.Enabled {
57 Cfg.Users.Registration = false
58 }
59 return err
60 }
61