cmd/gitbayd/testconfig_test.go

08a24a6e68d86f3dfd13c88a8125b580b1dc614b
gitbay/cmd/gitbayd/testconfig_test.go

24 lines · 563 bytes

 1package main
 2
 3import (
 4	"path/filepath"
 5	"testing"
 6
 7	"gitbay.org/gitbay/internal/config"
 8	"gitbay.org/gitbay/internal/seal"
 9)
10
11// testConfig is a config with a fresh root and a key file outside it,
12// the minimum openStore accepts.
13func testConfig(t *testing.T) config.Config {
14	t.Helper()
15	key := filepath.Join(t.TempDir(), "secret.key")
16	k, err := seal.NewKey()
17	if err != nil {
18		t.Fatal(err)
19	}
20	if err := seal.WriteKeys(key, []seal.Key{k}); err != nil {
21		t.Fatal(err)
22	}
23	return config.Config{Server: config.Server{Root: t.TempDir(), SecretKeyFile: key}}
24}
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form