3
0
corteza/pkg/options/HTTPServer.go
Denis Arh 1d59a3acf2 Allow custom URL prefix for all corteza endpoints
Add new env. variables and options
 - HTTP_BASE_URL to control URL prefix, defaults to /
 - HTTP_SSL_TERMINATED to explicitly set if Corteza is running behind HTTPS
Refresh and document webapp/Makefile with more dev tasks
Fix all absolute URLs in applications, logos, icons
Improve logic behind integrated webapp serving, inject/replace <base href> tag according to URL prefix
Prevent mounting api & webapps to the same base
2021-05-09 16:47:19 +02:00

16 lines
488 B
Go

package options
func (o *HTTPServerOpt) Defaults() {
o.BaseUrl = CleanBase(o.BaseUrl)
o.ApiBaseUrl = CleanBase(o.ApiBaseUrl)
o.WebappBaseUrl = CleanBase(o.WebappBaseUrl)
if o.WebappEnabled && o.ApiEnabled && (o.ApiBaseUrl == "/" || o.ApiBaseUrl == "") {
// api base URL is still on root (empty string)
// but webapps are enabled (that means, server also serves static files from WebappBaseDir)
//
// Let's be nice and move API to /api
o.ApiBaseUrl = CleanBase("api")
}
}