wisski-cloud-distillery/internal/wisski/liquid/domain.go
Tom Wiesing 945329a080
Move to yaml-based configuration
This commit updates the configuration to be yaml-based and updates the
configuration to read in a yaml file.
2023-02-25 09:14:56 +01:00

28 lines
554 B
Go

package liquid
import (
"net/url"
)
// Domain returns the full domain name of this WissKI
func (liquid *Liquid) Domain() string {
return liquid.Config.HTTP.HostFromSlug(liquid.Slug)
}
// URL returns the public URL of this instance
func (liquid *Liquid) URL() *url.URL {
// setup domain and path
url := &url.URL{
Host: liquid.Domain(),
Path: "/",
}
// use http or https scheme depending on if the distillery has it enabled
if liquid.Malt.Config.HTTP.HTTPSEnabled() {
url.Scheme = "https"
} else {
url.Scheme = "http"
}
return url
}