Move WissKI Parts to new ingredients system
This commit is contained in:
parent
b5b1ce2340
commit
42b8cbd865
83 changed files with 1016 additions and 646 deletions
29
internal/wisski/liquid/domain.go
Normal file
29
internal/wisski/liquid/domain.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package liquid
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// Domain returns the full domain name of this WissKI
|
||||
func (liquid *Liquid) Domain() string {
|
||||
return fmt.Sprintf("%s.%s", liquid.Slug, liquid.Malt.Config.DefaultDomain)
|
||||
}
|
||||
|
||||
// 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.HTTPSEnabled() {
|
||||
url.Scheme = "https"
|
||||
} else {
|
||||
url.Scheme = "http"
|
||||
}
|
||||
|
||||
return url
|
||||
}
|
||||
16
internal/wisski/liquid/liquid.go
Normal file
16
internal/wisski/liquid/liquid.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Package liquid provides Liquid
|
||||
package liquid
|
||||
|
||||
import (
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/instances/malt"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
)
|
||||
|
||||
// Liquid is the core of a WissKI Instance and used in every ingredient.
|
||||
type Liquid struct {
|
||||
*malt.Malt
|
||||
models.Instance
|
||||
|
||||
DrupalUsername string
|
||||
DrupalPassword string
|
||||
}
|
||||
10
internal/wisski/liquid/snapshots.go
Normal file
10
internal/wisski/liquid/snapshots.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package liquid
|
||||
|
||||
import "github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
|
||||
// Snapshots returns the list of snapshots of this WissKI
|
||||
// NOTE(twiesing): Not entirely sure where this should go.
|
||||
// It's not that this is
|
||||
func (liquid *Liquid) Snapshots() (snapshots []models.Export, err error) {
|
||||
return liquid.Malt.ExporterLog.For(liquid.Slug)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue