diff options
Diffstat (limited to '')
-rw-r--r-- | forged/internal/config/config.go | 96 |
1 files changed, 73 insertions, 23 deletions
diff --git a/forged/internal/config/config.go b/forged/internal/config/config.go index da28e05..1825882 100644 --- a/forged/internal/config/config.go +++ b/forged/internal/config/config.go @@ -7,32 +7,82 @@ import ( "os" "go.lindenii.runxiyu.org/forge/forged/internal/common/scfg" - "go.lindenii.runxiyu.org/forge/forged/internal/database" - "go.lindenii.runxiyu.org/forge/forged/internal/incoming/hooks" - "go.lindenii.runxiyu.org/forge/forged/internal/incoming/lmtp" - "go.lindenii.runxiyu.org/forge/forged/internal/incoming/ssh" - "go.lindenii.runxiyu.org/forge/forged/internal/incoming/web" - "go.lindenii.runxiyu.org/forge/forged/internal/ipc/irc" ) type Config struct { - DB database.Config `scfg:"db"` - Web web.Config `scfg:"web"` - Hooks hooks.Config `scfg:"hooks"` - LMTP lmtp.Config `scfg:"lmtp"` - SSH ssh.Config `scfg:"ssh"` - IRC irc.Config `scfg:"irc"` - Git struct { - RepoDir string `scfg:"repo_dir"` - Socket string `scfg:"socket"` - } `scfg:"git"` - General struct { - Title string `scfg:"title"` - } `scfg:"general"` - Pprof struct { - Net string `scfg:"net"` - Addr string `scfg:"addr"` - } `scfg:"pprof"` + DB DB `scfg:"db"` + Web Web `scfg:"web"` + Hooks Hooks `scfg:"hooks"` + LMTP LMTP `scfg:"lmtp"` + SSH SSH `scfg:"ssh"` + IRC IRC `scfg:"irc"` + Git Git `scfg:"git"` + General General `scfg:"general"` + Pprof Pprof `scfg:"pprof"` +} + +type DB struct { + Conn string `scfg:"conn"` +} + +type Web struct { + Net string `scfg:"net"` + Addr string `scfg:"addr"` + Root string `scfg:"root"` + CookieExpiry int `scfg:"cookie_expiry"` + ReadTimeout uint32 `scfg:"read_timeout"` + WriteTimeout uint32 `scfg:"write_timeout"` + IdleTimeout uint32 `scfg:"idle_timeout"` + MaxHeaderBytes int `scfg:"max_header_bytes"` + ReverseProxy bool `scfg:"reverse_proxy"` + ShutdownTimeout uint32 `scfg:"shutdown_timeout"` + TemplatesPath string `scfg:"templates_path"` + StaticPath string `scfg:"static_path"` +} + +type Hooks struct { + Socket string `scfg:"socket"` + Execs string `scfg:"execs"` +} + +type LMTP struct { + Socket string `scfg:"socket"` + Domain string `scfg:"domain"` + MaxSize int64 `scfg:"max_size"` + WriteTimeout uint32 `scfg:"write_timeout"` + ReadTimeout uint32 `scfg:"read_timeout"` +} + +type SSH struct { + Net string `scfg:"net"` + Addr string `scfg:"addr"` + Key string `scfg:"key"` + Root string `scfg:"root"` + ShutdownTimeout uint32 `scfg:"shutdown_timeout"` +} + +type IRC struct { + Net string `scfg:"net"` + Addr string `scfg:"addr"` + TLS bool `scfg:"tls"` + SendQ uint `scfg:"sendq"` + Nick string `scfg:"nick"` + User string `scfg:"user"` + Gecos string `scfg:"gecos"` +} + +type Git struct { + RepoDir string `scfg:"repo_dir"` + Socket string `scfg:"socket"` +} + +type General struct { + Title string `scfg:"title"` +} + +type Pprof struct { + Net string `scfg:"net"` + Addr string `scfg:"addr"` } func Open(path string) (config Config, err error) { |