Monorepo for Tangled tangled.org
8

Configure Feed

Select the types of activity you want to include in your feed.

1package config 2 3import ( 4 "context" 5 "time" 6 7 "github.com/sethvargo/go-envconfig" 8) 9 10type Config struct { 11 PlcUrl string `env:"MIRROR_PLC_URL, default=https://plc.directory"` 12 TapUrl string `env:"MIRROR_TAP_URL, default=http://localhost:2480"` 13 DbUrl string `env:"MIRROR_DB_URL, required"` 14 RedisAddr string `env:"MIRROR_REDIS_ADDR, required"` 15 KnotUseSSL bool `env:"MIRROR_KNOT_USE_SSL, default=false"` // use SSL for Knot when not scheme is not specified 16 KnotSSRF bool `env:"MIRROR_KNOT_SSRF, default=false"` 17 GitRepoBasePath string `env:"MIRROR_GIT_BASEPATH, default=repos"` 18 GitRepoFetchTimeout time.Duration `env:"MIRROR_GIT_FETCH_TIMEOUT, default=600s"` 19 Search SearchConfig `env:",prefix=MIRROR_SEARCH_"` 20 ResyncParallelism int `env:"MIRROR_RESYNC_PARALLELISM, default=5"` 21 Slurper SlurperConfig `env:",prefix=MIRROR_SLURPER_"` 22 UseSSL bool `env:"MIRROR_USE_SSL, default=false"` 23 Hostname string `env:"MIRROR_HOSTNAME, required"` 24 Listen string `env:"MIRROR_LISTEN, default=:7000"` 25 MetricsListen string `env:"MIRROR_METRICS_LISTEN, default=127.0.0.1:7100"` 26 AdminListen string `env:"MIRROR_ADMIN_LISTEN, default=127.0.0.1:7200"` 27} 28 29func (c *Config) BaseUrl() string { 30 if c.UseSSL { 31 return "https://" + c.Hostname 32 } 33 return "http://" + c.Hostname 34} 35 36type SlurperConfig struct { 37 PersistCursorPeriod time.Duration `env:"PERSIST_CURSOR_PERIOD, default=4s"` 38 ConcurrencyPerHost int `env:"CONCURRENCY, default=4"` 39} 40 41type SearchConfig struct { 42 ZoektUrl string `env:"ZOEKT_URL"` // base url to zoekt node. skipped when empty 43} 44 45func Load(ctx context.Context) (*Config, error) { 46 var cfg Config 47 if err := envconfig.Process(ctx, &cfg); err != nil { 48 return nil, err 49 } 50 return &cfg, nil 51}