Remove environment.Environment struct

This commit completely removes the environment struct as it is no longer
used.
This commit is contained in:
Tom Wiesing 2023-03-02 12:52:51 +01:00
parent 3263920d6b
commit 473040a69f
No known key found for this signature in database
40 changed files with 91 additions and 146 deletions

View file

@ -18,7 +18,7 @@ func (*SQL) BackupName() string {
// Backup makes a backup of all SQL databases into the path dest.
func (sql *SQL) Backup(scontext component.StagingContext) error {
return scontext.AddFile("", func(ctx context.Context, file io.Writer) error {
code := sql.Stack(sql.Environment).Exec(ctx, stream.NonInteractive(scontext.Progress()), "sql", "mysqldump", "--all-databases")()
code := sql.Stack().Exec(ctx, stream.NonInteractive(scontext.Progress()), "sql", "mysqldump", "--all-databases")()
if code != 0 {
return errSQLBackup
}

View file

@ -23,7 +23,7 @@ func (sql *SQL) Snapshot(wisski models.Instance, scontext component.StagingConte
// SnapshotDB makes a backup of the sql database into dest.
func (sql *SQL) SnapshotDB(ctx context.Context, progress io.Writer, dest io.Writer, database string) error {
code := sql.Stack(sql.Environment).Exec(ctx, stream.NonInteractive(progress), "sql", "mysqldump", "--databases", database)()
code := sql.Stack().Exec(ctx, stream.NonInteractive(progress), "sql", "mysqldump", "--databases", database)()
if code != 0 {
return errSQLBackup
}

View file

@ -6,7 +6,6 @@ import (
"time"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
"github.com/FAU-CDI/wisski-distillery/pkg/fsx"
"github.com/tkw1536/pkglib/lazy"
)
@ -43,8 +42,8 @@ func (*SQL) Context(parent component.InstallationContext) component.Installation
//go:embed sql.env
var resources embed.FS
func (sql *SQL) Stack(env environment.Environment) component.StackWithResources {
return component.MakeStack(sql, env, component.StackWithResources{
func (sql *SQL) Stack() component.StackWithResources {
return component.MakeStack(sql, component.StackWithResources{
Resources: resources,
ContextPath: "sql",

View file

@ -19,7 +19,7 @@ import (
//
// NOTE(twiesing): This command should not be used to connect to the database or execute queries except in known situations.
func (sql *SQL) Shell(ctx context.Context, io stream.IOStream, argv ...string) int {
return sql.Stack(sql.Environment).Exec(ctx, io, "sql", "mysql", argv...)()
return sql.Stack().Exec(ctx, io, "sql", "mysql", argv...)()
}
// unsafeWaitShell waits for a connection via the database shell to succeed