forked from livegrep/livegrep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
100 lines (76 loc) · 2.99 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package config
import (
"html/template"
)
type Backend struct {
Id string `json:"id"`
Addr string `json:"addr"`
}
type Honeycomb struct {
WriteKey string `json:"write_key"`
Dataset string `json:"dataset"`
}
type Config struct {
// Location of the directory containing templates and static
// assets. This should point at the "web" directory of the
// repository.
DocRoot string `json:"docroot"`
Feedback struct {
// The mailto address for the "feedback" url.
MailTo string `json:"mailto"`
} `json:"feedback"`
GoogleAnalyticsId string `json:"google_analytics_id"`
// Should we respect X-Real-Ip, X-Real-Proto, and X-Forwarded-Host?
ReverseProxy bool `json:"reverse_proxy"`
// List of backends to connect to. Each backend must include
// the "id" and "addr" fields.
Backends []Backend `json:"backends"`
// The address to listen on, as HOST:PORT.
Listen string `json:"listen"`
// HTML injected into layout template
// for site-specific customizations
HeaderHTML template.HTML `json:"header_html"`
// HTML injected into layout template
// just before </body> for site-specific customization
FooterHTML template.HTML `json:"footer_html"`
Sentry struct {
URI string `json:"uri"`
} `json:"sentry"`
// Whether to re-load templates on every request
Reload bool `json:"reload"`
// honeycomb API write key
Honeycomb Honeycomb `json:"honeycomb"`
DefaultMaxMatches int32 `json:"default_max_matches"`
// Same json config structure that the backend uses when building indexes;
// used here for repository browsing.
IndexConfig IndexConfig `json:"index_config"`
DefaultSearchRepos []string `json:"default_search_repos"`
LinkConfigs []LinkConfig `json:"file_links"`
// Maximum gRPC receive message size in bytes: this allows larger result sets from codesearch
GrpcMaxRecvMessageSize int `json:"grpc_max_recv_message_size"`
// Maximum gRPC send message size in bytes: this allows larger queries to codesearch
GrpcMaxSendMessageSize int `json:"grpc_max_send_message_size"`
// Additional file extensions to highlight with PrismJS in the built-in fileview
FileExtToLang map[string]string `json:"file_ext_to_lang"`
// Regular expression to match the first line of a file to determine its
// language. This is used to override the language detection for files that
// don't have a recognized extension.
FileFirstLineRegexToLang map[string]string `json:"file_first_line_regex_to_lang"`
}
type IndexConfig struct {
Name string `json:"name"`
Repositories []RepoConfig `json:"repositories"`
}
type RepoConfig struct {
Path string `json:"path"`
Name string `json:"name"`
Revisions []string `json:"revisions"`
Metadata map[string]string `json:"metadata"`
WalkSubmodules bool `json:"walk_submodules"`
}
type LinkConfig struct {
Label string `json:"label"`
UrlTemplate string `json:"url_template"`
WhitelistPattern string `json:"whitelist_pattern"`
Target string `json:"target"`
}