Split up WissKI Instance code
This commit is contained in:
parent
d7110dd63c
commit
85b5603d9d
16 changed files with 285 additions and 244 deletions
29
internal/component/instances/wisski_props.go
Normal file
29
internal/component/instances/wisski_props.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue