Require access to Still via method
This commit adds a safeguard to accessing the still from a specific component by requiring access via the component.GetStill method.
This commit is contained in:
parent
81fa84c244
commit
8235ea9105
63 changed files with 288 additions and 197 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/config"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/config/validators"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/wisski"
|
||||
)
|
||||
|
|
@ -37,22 +38,24 @@ func (instances *Instances) Create(slug string, system models.System) (wissKI *w
|
|||
wissKI.Liquid.Instance.OwnerEmail = ""
|
||||
wissKI.Liquid.Instance.AutoBlindUpdateEnabled = true
|
||||
|
||||
config := component.GetStill(instances).Config
|
||||
|
||||
// sql
|
||||
|
||||
wissKI.Liquid.Instance.SqlDatabase = instances.Config.SQL.DataPrefix + slug
|
||||
wissKI.Liquid.Instance.SqlUsername = instances.Config.SQL.UserPrefix + slug
|
||||
wissKI.Liquid.Instance.SqlDatabase = config.SQL.DataPrefix + slug
|
||||
wissKI.Liquid.Instance.SqlUsername = config.SQL.UserPrefix + slug
|
||||
|
||||
wissKI.Liquid.Instance.SqlPassword, err = instances.Config.NewPassword()
|
||||
wissKI.Liquid.Instance.SqlPassword, err = config.NewPassword()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// triplestore
|
||||
|
||||
wissKI.Liquid.Instance.GraphDBRepository = instances.Config.TS.DataPrefix + slug
|
||||
wissKI.Liquid.Instance.GraphDBUsername = instances.Config.TS.UserPrefix + slug
|
||||
wissKI.Liquid.Instance.GraphDBRepository = config.TS.DataPrefix + slug
|
||||
wissKI.Liquid.Instance.GraphDBUsername = config.TS.UserPrefix + slug
|
||||
|
||||
wissKI.Liquid.Instance.GraphDBPassword, err = instances.Config.NewPassword()
|
||||
wissKI.Liquid.Instance.GraphDBPassword, err = config.NewPassword()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -61,7 +64,7 @@ func (instances *Instances) Create(slug string, system models.System) (wissKI *w
|
|||
|
||||
wissKI.Liquid.DrupalUsername = "admin" // TODO: Change this!
|
||||
|
||||
wissKI.Liquid.DrupalPassword, err = instances.Config.NewPassword()
|
||||
wissKI.Liquid.DrupalPassword, err = config.NewPassword()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ type Instances struct {
|
|||
}
|
||||
|
||||
func (instances *Instances) Path() string {
|
||||
return filepath.Join(instances.Still.Config.Paths.Root, "instances")
|
||||
return filepath.Join(component.GetStill(instances).Config.Paths.Root, "instances")
|
||||
}
|
||||
|
||||
// ErrWissKINotFound is returned when a WissKI is not found
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/unpack"
|
||||
"github.com/tkw1536/goprogram/exit"
|
||||
)
|
||||
|
|
@ -22,7 +23,7 @@ var runtimeResources embed.FS
|
|||
|
||||
// Update installs or updates runtime components needed by this component.
|
||||
func (instances *Instances) Update(ctx context.Context, progress io.Writer) error {
|
||||
err := unpack.InstallDir(instances.Config.Paths.RuntimeDir(), "runtime", runtimeResources, func(dst, src string) {
|
||||
err := unpack.InstallDir(component.GetStill(instances).Config.Paths.RuntimeDir(), "runtime", runtimeResources, func(dst, src string) {
|
||||
fmt.Fprintf(progress, "[copy] %s\n", dst)
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue