aboutsummaryrefslogtreecommitdiff
path: root/pkg/config
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-06-15 19:07:14 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-06-15 19:07:14 +0200
commitce5185f551b707fe8dd8db8b5cbffd46e96cacc0 (patch)
treeb4b83a117a7c479589cfce022011e725e24529e8 /pkg/config
parentb71c6c0e5b8dd00d44e40ac0551902a23cbe19d5 (diff)
downloadcerrado-ce5185f551b707fe8dd8db8b5cbffd46e96cacc0.tar.gz
cerrado-ce5185f551b707fe8dd8db8b5cbffd46e96cacc0.tar.bz2
cerrado-ce5185f551b707fe8dd8db8b5cbffd46e96cacc0.zip
feat: Add per repository about page
Diffstat (limited to 'pkg/config')
-rw-r--r--pkg/config/config.go6
-rw-r--r--pkg/config/config_test.go6
2 files changed, 12 insertions, 0 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 6ac6d05..3759b7c 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -42,6 +42,7 @@ type (
Path string
Description string
Public bool
+ About string
}
// ConfigurationRepository represents the configuration repository (as in
@@ -214,6 +215,10 @@ func setRepositories(block scfg.Block, repositories *[]*GitRepositoryConfigurati
if err := setBool(d, &repository.Public); err != nil {
return err
}
+ case "about":
+ if err := setString(d, &repository.About); err != nil {
+ return err
+ }
}
}
@@ -249,6 +254,7 @@ func defaultRepisotryConfiguration(path string) *GitRepositoryConfiguration {
Name: filepath.Base(path),
Description: "",
Public: false,
+ About: "README.md",
}
}
diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go
index 2d779c5..8c1d27e 100644
--- a/pkg/config/config_test.go
+++ b/pkg/config/config_test.go
@@ -53,6 +53,7 @@ scan "/srv/git" {
Path: "/srv/git/cerrado.git",
Description: "",
Public: false,
+ About: "README.md",
},
},
},
@@ -64,6 +65,7 @@ repository /srv/git/cerrado.git {
name cerrado
description "Single person forge"
public true
+ about readme.txt
}`,
expectedConfig: &configuration{
Scan: defaultScan(),
@@ -74,6 +76,7 @@ repository /srv/git/cerrado.git {
Path: "/srv/git/cerrado.git",
Description: "Single person forge",
Public: true,
+ About: "readme.txt",
},
},
},
@@ -111,6 +114,7 @@ repository /srv/git/cerrado.git {
name cerrado
description "Single person forge"
public true
+ about readme.txt
}`,
expectedConfig: &configuration{
Scan: &scan{
@@ -124,12 +128,14 @@ repository /srv/git/cerrado.git {
Path: "/srv/git/linux.git",
Description: "",
Public: false,
+ About: "README.md",
},
{
Name: "cerrado",
Path: "/srv/git/cerrado.git",
Description: "Single person forge",
Public: true,
+ About: "readme.txt",
},
},
},