Move wisski instance code to separate package

This commit is contained in:
Tom Wiesing 2022-10-17 14:20:15 +02:00
parent 7c3c84e116
commit 063f3f9b7d
No known key found for this signature in database
67 changed files with 533 additions and 409 deletions

View file

@ -1,29 +0,0 @@
package instances
import (
"fmt"
"net/url"
)
// Domain returns the full domain name of this WissKI
func (wisski WissKI) Domain() string {
return fmt.Sprintf("%s.%s", wisski.Slug, wisski.instances.Config.DefaultDomain)
}
// URL returns the public URL of this instance
func (wisski WissKI) URL() *url.URL {
// setup domain and path
url := &url.URL{
Host: wisski.Domain(),
Path: "/",
}
// use http or https scheme depending on if the distillery has it enabled
if wisski.instances.Config.HTTPSEnabled() {
url.Scheme = "https"
} else {
url.Scheme = "http"
}
return url
}