vole
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software:2222/vole.git
A free and open-source forge that lives in your Git repo.
Expand the admin status page into an operational dashboard
4506a4d3d279556435fdd414265e7499c3dada16 · Keenan Nemetz · 14d ago · parent 2e024cc9
forge/instance.go +23−9
| @@ -20,21 +20,23 @@ import ( | |||
| 20 | 20 | "github.com/rodent-software/vole/forge/config" | |
| 21 | 21 | "github.com/rodent-software/vole/forge/identity" | |
| 22 | 22 | "github.com/rodent-software/vole/forge/index" | |
| 23 | "github.com/rodent-software/vole/forge/pageview" | ||
| 23 | 24 | "github.com/rodent-software/vole/forge/repo" | |
| 24 | 25 | "github.com/rodent-software/vole/forge/session" | |
| 25 | 26 | ) | |
| 26 | 27 | ||
| 27 | 28 | // Instance is the state a running or administered Vole instance owns. | |
| 28 | 29 | type Instance struct { | |
| 29 | Cfg *config.Config | ||
| 30 | Repos *repo.Store | ||
| 31 | Identity *identity.Store | ||
| 32 | Sessions *session.Store | ||
| 33 | Index *index.Store | ||
| 34 | Runs *runs.Store | ||
| 35 | ACLs *access.Store | ||
| 36 | Locks *lfs.LockStore | ||
| 37 | LFS *lfs.Store | ||
| 30 | Cfg *config.Config | ||
| 31 | Repos *repo.Store | ||
| 32 | Identity *identity.Store | ||
| 33 | Sessions *session.Store | ||
| 34 | Index *index.Store | ||
| 35 | Runs *runs.Store | ||
| 36 | ACLs *access.Store | ||
| 37 | Locks *lfs.LockStore | ||
| 38 | LFS *lfs.Store | ||
| 39 | PageViews *pageview.Store | ||
| 38 | 40 | ||
| 39 | 41 | // ImportedACLs is how many legacy refs/vole/acl rule sets were imported by | |
| 40 | 42 | // Open, so a caller that logs startup can say so. | |
| @@ -109,6 +111,16 @@ func Open(cfg *config.Config, binPath string) (*Instance, error) { | |||
| 109 | 111 | ident.Close() | |
| 110 | 112 | return nil, err | |
| 111 | 113 | } | |
| 114 | views, err := pageview.Open(cfg.UsersDB()) | ||
| 115 | if err != nil { | ||
| 116 | lk.Close() | ||
| 117 | acls.Close() | ||
| 118 | rn.Close() | ||
| 119 | ix.Close() | ||
| 120 | sessions.Close() | ||
| 121 | ident.Close() | ||
| 122 | return nil, fmt.Errorf("open page views: %w", err) | ||
| 123 | } | ||
| 112 | 124 | ||
| 113 | 125 | return &Instance{ | |
| 114 | 126 | Cfg: cfg, | |
| @@ -120,6 +132,7 @@ func Open(cfg *config.Config, binPath string) (*Instance, error) { | |||
| 120 | 132 | ACLs: acls, | |
| 121 | 133 | Locks: lk, | |
| 122 | 134 | LFS: lfs.New(cfg.LFSDir(), cfg.LFSObjectMaxBytes), | |
| 135 | PageViews: views, | ||
| 123 | 136 | ImportedACLs: imported, | |
| 124 | 137 | }, nil | |
| 125 | 138 | } | |
| @@ -144,6 +157,7 @@ func (i *Instance) Close() error { | |||
| 144 | 157 | } | |
| 145 | 158 | var err error | |
| 146 | 159 | for _, closeFn := range []func() error{ | |
| 160 | i.PageViews.Close, | ||
| 147 | 161 | i.Locks.Close, | |
| 148 | 162 | i.ACLs.Close, | |
| 149 | 163 | i.Runs.Close, | |