Initialize run.Configs in the NewSTEP functions [#67]
This fixes the run package's leaky abstraction; other packages no longer need to know or care that run.Config even exists. Note that since the various Steps now depend on having a non-nil pointer to a run.Config, it's unsafe (or at least risky) to initialize them directly. They should be created with their NewSTEPNAME functions. All their fields are now private, to reflect this.
This commit is contained in:
@@ -1,13 +1,22 @@
|
||||
package run
|
||||
|
||||
import (
|
||||
"github.com/pelotech/drone-helm3/internal/env"
|
||||
"io"
|
||||
)
|
||||
|
||||
// Config contains configuration applicable to all helm commands
|
||||
type Config struct {
|
||||
Debug bool
|
||||
Namespace string
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
type config struct {
|
||||
debug bool
|
||||
namespace string
|
||||
stdout io.Writer
|
||||
stderr io.Writer
|
||||
}
|
||||
|
||||
func newConfig(cfg env.Config) *config {
|
||||
return &config{
|
||||
debug: cfg.Debug,
|
||||
namespace: cfg.Namespace,
|
||||
stdout: cfg.Stdout,
|
||||
stderr: cfg.Stderr,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user