gshr
git static host repo -- generates static html for repos
git clone https://git.vogt.world/gshr.git
Log | Files | README.md | LICENSE
← Commit log
commit
message
Renaming some config fields
author
Ben Vogt <[email protected]>
date
2023-04-05 14:37:41
stats
5 file(s) changed, 13 insertions(+), 13 deletions(-)
files
config.go
gshr.toml
main.go
templates/index.html
templates/partials.html
  1diff --git a/config.go b/config.go
  2index d9697c6..9500b47 100644
  3--- a/config.go
  4+++ b/config.go
  5@@ -11,10 +11,10 @@ type Config struct {
  6 }
  7 
  8 type Repo struct {
  9-	Name        string
 10-	Description string
 11-	Path        string
 12-	GitURL      string `toml:"git_url"`
 13+	Name            string
 14+	Description     string
 15+	URL             string
 16+	PublishedGitURL string `toml:"published_git_url"`
 17 }
 18 
 19 func ParseConfiguration(data string) Config {
 20@@ -26,7 +26,7 @@ func ParseConfiguration(data string) Config {
 21 
 22 type RepoData struct {
 23 	Name            string
 24-	GitURL          string
 25+	PublishedGitURL string
 26 	Description     string
 27 	BaseURL         string
 28 	ReadMePath      string
 29diff --git a/gshr.toml b/gshr.toml
 30index 1516496..e0cdcc7 100644
 31--- a/gshr.toml
 32+++ b/gshr.toml
 33@@ -4,17 +4,17 @@ site_name = "public, self hosted git repositories"
 34 [[repos]]
 35 name = "gshr"
 36 description = "git static host repo -- generates static html for repos"
 37-path = "/Users/bvogt/dev/src/ben/gshr"
 38-git_url = "[email protected]:vogtb/gshr.git"
 39+url = "/Users/bvogt/dev/src/ben/gshr"
 40+published_git_url = "[email protected]:vogtb/gshr.git"
 41 
 42 [[repos]]
 43 name = "www"
 44 description = "static site for www.vogt.world"
 45-path = "/Users/bvogt/dev/src/ben/www"
 46-git_url = "[email protected]:vogtb/www.git"
 47+url = "/Users/bvogt/dev/src/ben/www"
 48+published_git_url = "[email protected]:vogtb/www.git"
 49 
 50 [[repos]]
 51 name = "f7"
 52 description = "f7 is a spreadsheet formula execution library"
 53-path = "/Users/bvogt/dev/src/ben/f7"
 54-git_url = "[email protected]:vogtb/f7.git"
 55+url = "/Users/bvogt/dev/src/ben/f7"
 56+published_git_url = "[email protected]:vogtb/f7.git"
 57diff --git a/main.go b/main.go
 58index 4f9af89..f51c2ab 100644
 59--- a/main.go
 60+++ b/main.go
 61@@ -68,12 +68,12 @@ func CloneAndGetData(repo Repo, r *git.Repository) RepoData {
 62 	err = os.MkdirAll(path.Join(args.OutputDir, repo.Name), 0755)
 63 	checkErr(err)
 64 	repoRef, err := git.PlainClone(path.Join(args.CloneDir, repo.Name), false, &git.CloneOptions{
 65-		URL: repo.Path,
 66+		URL: repo.URL,
 67 	})
 68 	checkErr(err)
 69 	data := RepoData{
 70 		Name:            repo.Name,
 71-		GitURL:          repo.GitURL,
 72+		PublishedGitURL: repo.PublishedGitURL,
 73 		Description:     repo.Description,
 74 		BaseURL:         config.BaseURL,
 75 		ReadMePath:      findFileInRoot(repo.Name, settings.AllowedReadMeFiles),
 76diff --git a/templates/index.html b/templates/index.html
 77index cad9ad0..3f5b874 100644
 78--- a/templates/index.html
 79+++ b/templates/index.html
 80@@ -41,8 +41,8 @@
 81               </td>
 82               <td>
 83                 git clone
 84-                <a href="{{ .GitURL }}">
 85-                  {{ .GitURL }}
 86+                <a href="{{ .PublishedGitURL }}">
 87+                  {{ .PublishedGitURL }}
 88                 </a>
 89               </td>
 90             </tr>
 91diff --git a/templates/partials.html b/templates/partials.html
 92index e023016..c8d6f53 100644
 93--- a/templates/partials.html
 94+++ b/templates/partials.html
 95@@ -40,7 +40,7 @@
 96       </tr>
 97       <tr>
 98         <td>
 99-          <a href="{{ .GitURL }}">{{ .GitURL }}</a>
100+          <a href="{{ .PublishedGitURL }}">{{ .PublishedGitURL }}</a>
101         </td>
102       </tr>
103       <tr>