3
0
Files
corteza/pkg/options/HTTPServer.go
2022-02-08 09:13:56 +01: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")
}
}