Changes
3 changed files (+16/-15)
-
-
@@ -1,7 +1,5 @@repo: # Directory containing git repositories to serve. # Relative path is resolved from *current working directory* not from # path to the config file. scanPath: /var/www/git # Which filename will be treated as README file?
-
@@ -28,14 +26,10 @@ dirs:# Path to a directory containing HTML templates. # Templates are written in Go's html/template syntax. # <https://pkg.go.dev/html/template> # Relative path is resolved from *current working directory* not from # path to the config file. templates: ./templates # Path to a directory containing static assets. # User can access files in this directory by accessing "/static/*". # Relative path is resolved from *current working directory* not from # path to the config file. static: ./static meta:
-
-
-
@@ -43,15 +43,25 @@ if err := yaml.Unmarshal(b, &c); err != nil {return nil, fmt.Errorf("parsing config: %w", err) } if c.Repo.ScanPath, err = filepath.Abs(c.Repo.ScanPath); err != nil { if c.Repo.ScanPath, err = resolvePath(c.Repo.ScanPath, f); err != nil { return nil, err } if c.Dirs.Templates, err = filepath.Abs(c.Dirs.Templates); err != nil { if c.Dirs.Templates, err = resolvePath(c.Dirs.Templates, f); err != nil { return nil, err } if c.Dirs.Static, err = filepath.Abs(c.Dirs.Static); err != nil { if c.Dirs.Static, err = resolvePath(c.Dirs.Static, f); err != nil { return nil, err } return &c, nil } func resolvePath(target string, configPath string) (string, error) { if filepath.IsAbs(target) { return target, nil } dir := filepath.Dir(configPath) return filepath.Abs(filepath.Join(dir, target)) }
-
-
-
@@ -14,8 +14,7 @@ ## cd demo && git clone --bare https://your-git-repo repo: # TODO: Change to relative path once path resolution is fixed scanPath: ./demo scanPath: . readme: - readme - README
-
@@ -30,10 +29,8 @@ - main- trunk dirs: # TODO: Change to relative path once path resolution is fixed templates: ./templates # TODO: Change to relative path once path resolution is fixed static: ./static templates: ../templates static: ../static meta: title: legit Demo
-