💾 Archived View for gemini.rmf-dev.com › repo › Vaati › Gemigit › files › a26eb41bcd54e1a8bdb4755aa7… captured on 2023-12-28 at 15:32:26. 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 StaticDirectory string
19 }
20 Git struct {
21 Http struct {
22 Enabled bool
23 Https bool
24 Domain string `validate:"required"`
25 Address string `validate:"required"`
26 Port int `validate:"required"`
27 }
28 SSH struct {
29 Enabled bool
30 Domain string `validate:"required"`
31 Address string `validate:"required"`
32 Port int `validate:"required"`
33 }
34 Remote struct {
35 Enabled bool
36 Url string
37 Address string
38 Key string
39 }
40 Path string `validate:"required"`
41 Key string
42 Public bool
43 MaximumCommits int
44 }
45 Ldap struct {
46 Enabled bool
47 Url string
48 Attribute string
49 Binding string
50 }
51 Users struct {
52 Registration bool
53 }
54 Protection struct {
55 Ip int `validate:"required"`
56 Account int `validate:"required"`
57 Registration int `validate:"required"`
58 Reset int `validate:"required"`
59 }
60 }
61
62 func LoadConfig() error {
63 err := fig.Load(
64 &Cfg,
65 fig.File("config.yaml"),
66 fig.Dirs(".", "/etc/gemigit", "/usr/local/etc/gemigit"),
67 )
68 if err == nil && Cfg.Ldap.Enabled {
69 Cfg.Users.Registration = false
70 }
71 return err
72 }
73