feat: expose docs URL via static meta (#8594)

This commit is contained in:
Marcin Tojek 2023-07-19 18:57:43 +02:00 committed by GitHub
parent 517fb19474
commit 164672e5d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 0 deletions

View File

@ -310,6 +310,7 @@ func New(options *Options) *API {
Database: options.Database,
SiteFS: site.FS(),
OAuth2Configs: oauthConfigs,
DocsURL: options.DeploymentValues.DocsURL.String(),
})
staticHandler.Experiments.Store(&experiments)

View File

@ -21,6 +21,7 @@
<meta property="appearance" content="{{ .Appearance }}" />
<meta property="experiments" content="{{ .Experiments }}" />
<meta property="regions" content="{{ .Regions }}" />
<meta property="docs-url" content="{{ .DocsURL }}" />
<!-- We need to set data-react-helmet to be able to override it in the workspace page -->
<link
rel="alternate icon"

View File

@ -66,6 +66,7 @@ type Options struct {
Database database.Store
SiteFS fs.FS
OAuth2Configs *httpmw.OAuth2Configs
DocsURL string
}
func New(opts *Options) *Handler {
@ -167,6 +168,7 @@ func (h *Handler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
// Token is the CSRF token for the given request
CSRF: csrfState{Token: nosurf.Token(r)},
BuildInfo: h.buildInfoJSON,
DocsURL: h.opts.DocsURL,
}
// First check if it's a file we have in our templates
@ -236,6 +238,7 @@ type htmlState struct {
Appearance string
Experiments string
Regions string
DocsURL string
}
type csrfState struct {