diff options
| author | mo khan <mo@mokhan.ca> | 2025-03-31 14:22:58 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-03-31 14:22:58 -0600 |
| commit | deb9cd01de503baadc6c41ec4fbbe99b04db6ba3 (patch) | |
| tree | 82a68e64ab9ccbcf7b3de02d51d94f7d6b00e93d /magefiles | |
| parent | f00c6bd0f622200cdc4da0455ed1d903ff67d99e (diff) | |
chore: export step env vars with each command
Diffstat (limited to 'magefiles')
| -rw-r--r-- | magefiles/step.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/magefiles/step.go b/magefiles/step.go index 02708020..25cf23b0 100644 --- a/magefiles/step.go +++ b/magefiles/step.go @@ -46,7 +46,8 @@ func (s Step) Setup() { } func (s Step) Install() error { - return sh.Run( + return sh.RunWithV( + s.env(), "step", "certificate", "install", @@ -57,11 +58,8 @@ func (s Step) Install() error { func (s Step) Server(ctx context.Context) error { mg.SerialDeps(s.Setup) - env := map[string]string{ - "STEPPATH": s.path(), - } return sh.RunWithV( - env, + s.env(), "step-ca", s.pathPlus("config/ca.json"), "--password-file="+s.pathPlus("password.txt"), @@ -94,7 +92,8 @@ func (s Step) createCA() error { return nil } - return sh.Run( + return sh.RunWithV( + s.env(), "step", "ca", "init", @@ -122,7 +121,7 @@ func (s Step) enableACMEProvisioner() error { provisioners := items["authority"].(map[string]interface{})["provisioners"].([]interface{}) if len(provisioners) < 2 { - return sh.Run("step", "ca", "provisioner", "add", "acme", "--type", "ACME") + return sh.RunWithV(s.env(), "step", "ca", "provisioner", "add", "acme", "--type", "ACME") } return nil } @@ -135,6 +134,14 @@ func (s Step) path() string { return env.Fetch("STEPPATH", filepath.Join(x.Must(os.Getwd()), "/tmp/step")) } +func (s Step) env() map[string]string { + return map[string]string{ + "STEPPATH": s.path(), + "HOST": "localhost", + "PORT": "8081", + } +} + func (s Step) pathPlus(path string) string { return filepath.Join(s.path(), path) } |
