forked from
tangled.org/core
fork
Configure Feed
Select the types of activity you want to include in your feed.
this repo has no description
fork
Configure Feed
Select the types of activity you want to include in your feed.
1package config
2
3import (
4 "context"
5
6 "github.com/sethvargo/go-envconfig"
7)
8
9type Repo struct {
10 ScanPath string `env:"SCAN_PATH, default=/home/git"`
11 Readme []string `env:"README"`
12 MainBranch string `env:"MAIN_BRANCH, default=main"`
13}
14
15type Server struct {
16 ListenAddr string `env:"LISTEN_ADDR, default=0.0.0.0:5555"`
17 InternalListenAddr string `env:"INTERNAL_LISTEN_ADDR, default=127.0.0.1:5444"`
18 Secret string `env:"SECRET, required"`
19 DBPath string `env:"DB_PATH, default=knotserver.db"`
20 Hostname string `env:"HOSTNAME, required"`
21 JetstreamEndpoint string `env:"JETSTREAM_ENDPOINT, default=wss://jetstream1.us-west.bsky.network/subscribe"`
22
23 // This disables signature verification so use with caution.
24 Dev bool `env:"DEV, default=false"`
25}
26
27type Config struct {
28 Repo Repo `env:",prefix=KNOT_REPO_"`
29 Server Server `env:",prefix=KNOT_SERVER_"`
30 AppViewEndpoint string `env:"APPVIEW_ENDPOINT, default=https://tangled.sh"`
31}
32
33func Load(ctx context.Context) (*Config, error) {
34 var cfg Config
35 err := envconfig.Process(ctx, &cfg)
36 if err != nil {
37 return nil, err
38 }
39
40 if cfg.Repo.Readme == nil {
41 cfg.Repo.Readme = []string{
42 "README.md", "readme.md",
43 "README",
44 "readme",
45 "README.markdown",
46 "readme.markdown",
47 "README.txt",
48 "readme.txt",
49 "README.rst",
50 "readme.rst",
51 "README.org",
52 "readme.org",
53 "README.asciidoc",
54 "readme.asciidoc",
55 }
56 }
57
58 return &cfg, nil
59}