all repos — elgit @ 74eea2ebbccc8458b5b62002d281b2b49f5c30c4

fork of legit: web frontend for git, written in go

switch to gomponents

Alan Pearce
commit

74eea2ebbccc8458b5b62002d281b2b49f5c30c4

parent

776a7b0dafa651c5ba71381608e9726d9756c3b1

1 file changed, 28 insertions(+), 24 deletions(-)

changed files
M config/config.goconfig/config.go
@@ -8,28 +8,35 @@
"gopkg.in/yaml.v3" ) +type Repo struct { + ScanPath string `yaml:"scanPath"` + Readme []string `yaml:"readme"` + MainBranch []string `yaml:"mainBranch"` + Ignore []string `yaml:"ignore,omitempty"` + Unlisted []string `yaml:"unlisted,omitempty"` +} + +type Dirs struct { + Static string `yaml:"static"` +} + +type Meta struct { + Title string `yaml:"title"` + Description string `yaml:"description"` + SyntaxHighlight string `yaml:"syntaxHighlight"` +} + +type Server struct { + Name string `yaml:"name,omitempty"` + Host string `yaml:"host"` + Port int `yaml:"port"` +} + type Config struct { - Repo struct { - ScanPath string `yaml:"scanPath"` - Readme []string `yaml:"readme"` - MainBranch []string `yaml:"mainBranch"` - Ignore []string `yaml:"ignore,omitempty"` - Unlisted []string `yaml:"unlisted,omitempty"` - } `yaml:"repo"` - Dirs struct { - Templates string `yaml:"templates"` - Static string `yaml:"static"` - } `yaml:"dirs"` - Meta struct { - Title string `yaml:"title"` - Description string `yaml:"description"` - SyntaxHighlight string `yaml:"syntaxHighlight"` - } `yaml:"meta"` - Server struct { - Name string `yaml:"name,omitempty"` - Host string `yaml:"host"` - Port int `yaml:"port"` - } `yaml:"server"` + Repo Repo `yaml:"repo"` + Dirs Dirs `yaml:"dirs"` + Meta Meta `yaml:"meta"` + Server Server `yaml:"server"` } func Read(f string) (*Config, error) {
@@ -44,9 +51,6 @@ return nil, fmt.Errorf("parsing config: %w", err)
} if c.Repo.ScanPath, err = filepath.Abs(c.Repo.ScanPath); err != nil { - return nil, err - } - if c.Dirs.Templates, err = filepath.Abs(c.Dirs.Templates); err != nil { return nil, err } if c.Dirs.Static, err = filepath.Abs(c.Dirs.Static); err != nil {